本文整理汇总了Java中org.mongojack.JacksonDBCollection.ensureIndex方法的典型用法代码示例。如果您正苦于以下问题:Java JacksonDBCollection.ensureIndex方法的具体用法?Java JacksonDBCollection.ensureIndex怎么用?Java JacksonDBCollection.ensureIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mongojack.JacksonDBCollection
的用法示例。
在下文中一共展示了JacksonDBCollection.ensureIndex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CommentDAOImpl
import org.mongojack.JacksonDBCollection; //导入方法依赖的package包/类
public CommentDAOImpl() {
super(ID_VALUE_EXTRACTOR);
final JacksonDBCollection<Comment, String> dbCollection = getDbCollection();
dbCollection.ensureIndex("pageRef");
dbCollection.ensureIndex("postedByRef");
dbCollection.ensureIndex("parentRef");
}
示例2: UserDAOImpl
import org.mongojack.JacksonDBCollection; //导入方法依赖的package包/类
public UserDAOImpl() {
super(ID_VALUE_EXTRACTOR);
final JacksonDBCollection<User, String> dbCollection = getDbCollection();
dbCollection.ensureIndex("tags");
try {
dbCollection.ensureIndex(new BasicDBObject("username", 1), "username", true);
}
catch (MongoException e) {
LoggerFactory.getLogger(UserDAOImpl.class).error("Exception while creating username index", e);
}
}
示例3: initStatsCollections
import org.mongojack.JacksonDBCollection; //导入方法依赖的package包/类
public void initStatsCollections(final String coll) {
final String collname = "stats_" + coll;
final DBCollection collection;
if (database.collectionExists(collname)) {
collection = database.getCollection(collname);
} else {
final BasicDBObject capped = new BasicDBObject();
capped.put("capped", true);
capped.put("size", statssize);
collection = database.createCollection(collname, capped);
}
final JacksonDBCollection<StatsItem, String> statscoll = JacksonDBCollection.wrap(collection, StatsItem.class, String.class);
statscoll.ensureIndex(new BasicDBObject("timestamp", -1));
statscolls.put(coll, statscoll);
}
示例4: PageDAOImpl
import org.mongojack.JacksonDBCollection; //导入方法依赖的package包/类
public PageDAOImpl() {
super(ID_VALUE_EXTRACTOR);
final JacksonDBCollection<Page, String> dbCollection = getDbCollection();
dbCollection.ensureIndex(new BasicDBObject("uri", 1), "uri", true);
dbCollection.ensureIndex("tags");
}
示例5: TagDAOImpl
import org.mongojack.JacksonDBCollection; //导入方法依赖的package包/类
public TagDAOImpl() {
super(ID_VALUE_EXTRACTOR);
final JacksonDBCollection<Tag, String> dbCollection = getDbCollection();
dbCollection.ensureIndex(new BasicDBObject("name", 1), "name", true);
}