Java Code Examples for org.mongodb.morphia.Datastore#ensureCaps()

The following examples show how to use org.mongodb.morphia.Datastore#ensureCaps() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataStoreFactoryBean.java    From game-server with MIT License 5 votes vote down vote up
@Override
protected Datastore createInstance() throws Exception {
	// 这里的username和password可以为null,morphia对象会去处理
	MongoClientURI mongoClientURI = new MongoClientURI(uri);
	Datastore ds = morphia.createDatastore(new MongoClient(mongoClientURI), dbName);
	if (toEnsureIndexes) {
		ds.ensureIndexes();
	}
	if (toEnsureCaps) {
		ds.ensureCaps();
	}
	return ds;
}