Package io.mangoo.persistence
Class DatastoreImpl
- java.lang.Object
-
- io.mangoo.persistence.DatastoreImpl
-
-
Constructor Summary
Constructors Constructor Description DatastoreImpl(Config config)DatastoreImpl(String prefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> longcountAll(Class<T> clazz)Counts all objected of a mapped Morphia classvoiddelete(Object object)Deletes a mapped Morphia object in MongoDB<T> voiddeleteAll(Class<T> clazz)Deletes all mapped Morphia objects of a given classvoiddropDatabase()Drops all data in MongoDB on the connected databasevoidensureCaps()Ensure capped DBCollections for Entity(s)voidensureIndexes()Ensures (creating if necessary) the indexes found during class mapping (using @Indexed, @Indexes)<T> List<T>findAll(Class<T> clazz)Retrieves a list of mapped Morphia objects from MongoDB<T> TfindById(String id, Class<T> clazz)Retrieves a mapped Morphia object from MongoDB.dev.morphia.DatastoregetDatastore()com.mongodb.client.MongoClientgetMongoClient()dev.morphia.Datastorequery()voidsave(Object object)Saves a mapped Morphia object to MongoDB
-
-
-
Method Detail
-
getDatastore
public dev.morphia.Datastore getDatastore()
- Specified by:
getDatastorein interfaceDatastore
-
getMongoClient
public com.mongodb.client.MongoClient getMongoClient()
- Specified by:
getMongoClientin interfaceDatastore
-
ensureIndexes
public void ensureIndexes()
Description copied from interface:DatastoreEnsures (creating if necessary) the indexes found during class mapping (using @Indexed, @Indexes)- Specified by:
ensureIndexesin interfaceDatastore
-
ensureCaps
public void ensureCaps()
Description copied from interface:DatastoreEnsure capped DBCollections for Entity(s)- Specified by:
ensureCapsin interfaceDatastore
-
findById
public <T> T findById(String id, Class<T> clazz)
Description copied from interface:DatastoreRetrieves a mapped Morphia object from MongoDB. If the id is not of type ObjectId, it will be converted to ObjectId
-
findAll
public <T> List<T> findAll(Class<T> clazz)
Description copied from interface:DatastoreRetrieves a list of mapped Morphia objects from MongoDB
-
countAll
public <T> long countAll(Class<T> clazz)
Description copied from interface:DatastoreCounts all objected of a mapped Morphia class
-
save
public void save(Object object)
Description copied from interface:DatastoreSaves a mapped Morphia object to MongoDB
-
delete
public void delete(Object object)
Description copied from interface:DatastoreDeletes a mapped Morphia object in MongoDB
-
deleteAll
public <T> void deleteAll(Class<T> clazz)
Description copied from interface:DatastoreDeletes all mapped Morphia objects of a given class
-
dropDatabase
public void dropDatabase()
Description copied from interface:DatastoreDrops all data in MongoDB on the connected database- Specified by:
dropDatabasein interfaceDatastore
-
-