|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Datastore
Datastore interface to get/delete/save objects
| Method Summary | ||
|---|---|---|
|
createQuery(Class<T> kind)
Returns a new query bound to the kind (a specific DBCollection) |
|
|
createUpdateOperations(Class<T> kind)
The builder for all update operations |
|
|
delete(Class<T> clazz,
Iterable<V> ids)
Deletes the given entities (by id) |
|
|
delete(Class<T> clazz,
V id)
Deletes the given entity (by id) |
|
|
delete(Query<T> q)
Deletes the given entities based on the query |
|
|
delete(Query<T> q,
com.mongodb.WriteConcern wc)
Deletes the given entities based on the query, with the WriteConcern |
|
|
delete(T entity)
Deletes the given entity (by @Id) |
|
|
delete(T entity,
com.mongodb.WriteConcern wc)
Deletes the given entity (by @Id), with the WriteConcern |
|
void |
ensureCaps()
ensure capped DBCollections for Entity(s) |
|
|
ensureIndex(Class<T> clazz,
IndexFieldDef... fields)
Deprecated. |
|
|
ensureIndex(Class<T> clazz,
String fields)
Ensures (creating if necessary) the index including the field(s) + directions; eg fields = "field1, -field2" ({field1:1, field2:-1}) |
|
|
ensureIndex(Class<T> clazz,
String field,
IndexDirection dir)
Ensures (creating if necessary) the index and direction |
|
|
ensureIndex(Class<T> clazz,
String name,
IndexFieldDef[] fields,
boolean unique,
boolean dropDupsOnCreate)
Deprecated. |
|
|
ensureIndex(Class<T> clazz,
String name,
String fields,
boolean unique,
boolean dropDupsOnCreate)
Ensures (creating if necessary) the index including the field(s) + directions; eg fields = "field1, -field2" ({field1:1, field2:-1}) |
|
void |
ensureIndexes()
Ensures (creating if necessary) the indexes found during class mapping (using @Indexed, @Indexes) |
|
void |
ensureIndexes(boolean background)
Ensures (creating if necessary) the indexes found during class mapping (using @Indexed, @Indexes), possibly in the background |
|
|
ensureIndexes(Class<T> clazz)
Ensures (creating if necessary) the indexes found during class mapping (using @Indexed, @Indexes) |
|
|
ensureIndexes(Class<T> clazz,
boolean background)
Ensures (creating if necessary) the indexes found during class mapping (using @Indexed, @Indexes), possibly in the background |
|
Key<?> |
exists(Object keyOrEntity)
Does a query to check if the keyOrEntity exists in mongodb |
|
|
find(Class<T> clazz)
Find all instances by type |
|
|
find(Class<T> clazz,
String property,
V value)
Find all instances by collectionName, and filter property. |
|
|
find(Class<T> clazz,
String property,
V value,
int offset,
int size)
Find all instances by collectionName, and filter property. |
|
|
findAndDelete(Query<T> q)
Deletes the given entities based on the query (first item only). |
|
|
findAndModify(Query<T> q,
UpdateOperations<T> ops)
Find the first Entity from the Query, and modify it. |
|
|
findAndModify(Query<T> q,
UpdateOperations<T> ops,
boolean oldVersion)
Find the first Entity from the Query, and modify it. |
|
|
findAndModify(Query<T> q,
UpdateOperations<T> ops,
boolean oldVersion,
boolean createIfMissing)
Find the first Entity from the Query, and modify it. |
|
|
get(Class<T> clazz,
Iterable<V> ids)
Find the given entities (by id); shorthand for find("_id in", ids) |
|
|
get(Class<T> clazz,
V id)
Find the given entity (by id); shorthand for find("_id ", id) |
|
|
get(T entity)
Find the given entity (by collectionName/id); think of this as refresh |
|
|
getByKey(Class<T> clazz,
Key<T> key)
Find the given entity (by collectionName/id); |
|
|
getByKeys(Class<T> clazz,
Iterable<Key<T>> keys)
Find the given entities (by id), verifying they are of the correct type; shorthand for find("_id in", ids) |
|
|
getByKeys(Iterable<Key<T>> keys)
Find the given entities (by id); shorthand for find("_id in", ids) |
|
com.mongodb.DBCollection |
getCollection(Class<?> c)
|
|
|
getCount(Class<T> clazz)
Gets the count this kind ( DBCollection) |
|
|
getCount(Query<T> query)
Gets the count of items returned by this query; same as query.countAll() |
|
|
getCount(T entity)
Gets the count this kind ( DBCollection) |
|
com.mongodb.DB |
getDB()
|
|
com.mongodb.WriteConcern |
getDefaultWriteConcern()
|
|
|
getKey(T entity)
Creates a (type-safe) reference to the entity; if stored this will become a DBRef |
|
com.mongodb.Mongo |
getMongo()
|
|
|
mapReduce(MapreduceType type,
Query q,
String map,
String reduce,
String finalize,
Map<String,Object> scopeFields,
Class<T> outputType)
|
|
|
merge(T entity)
Work as if you did an update with each field in the entity doing a $set; Only at the top level of the entity. |
|
|
merge(T entity,
com.mongodb.WriteConcern wc)
Work as if you did an update with each field in the entity doing a $set; Only at the top level of the entity. |
|
|
save(Iterable<T> entities)
Saves the entities (Objects) and updates the @Id field |
|
|
save(Iterable<T> entities,
com.mongodb.WriteConcern wc)
Saves the entities (Objects) and updates the @Id field, with the WriteConcern |
|
|
save(T... entities)
Saves the entities (Objects) and updates the @Id field |
|
|
save(T entity)
Saves the entity (Object) and updates the @Id field |
|
|
save(T entity,
com.mongodb.WriteConcern wc)
Saves the entity (Object) and updates the @Id field, with the WriteConcern |
|
void |
setDefaultWriteConcern(com.mongodb.WriteConcern wc)
|
|
|
update(Key<T> key,
UpdateOperations<T> ops)
updates the entity with the operations; this is an atomic operation |
|
|
update(Query<T> query,
UpdateOperations<T> ops)
updates all entities found with the operations; this is an atomic operation per entity |
|
|
update(Query<T> query,
UpdateOperations<T> ops,
boolean createIfMissing)
updates all entities found with the operations, if nothing is found insert the update as an entity if "createIfMissing" is true; this is an atomic operation per entity |
|
|
update(Query<T> query,
UpdateOperations<T> ops,
boolean createIfMissing,
com.mongodb.WriteConcern wc)
|
|
|
update(T ent,
UpdateOperations<T> ops)
updates the entity with the operations; this is an atomic operation |
|
|
updateFirst(Query<T> query,
T entity,
boolean createIfMissing)
updates the first entity found with the operations, if nothing is found insert the update as an entity if "createIfMissing" is true; this is an atomic operation per entity |
|
|
updateFirst(Query<T> query,
UpdateOperations<T> ops)
updates the first entity found with the operations; this is an atomic operation |
|
|
updateFirst(Query<T> query,
UpdateOperations<T> ops,
boolean createIfMissing)
updates the first entity found with the operations, if nothing is found insert the update as an entity if "createIfMissing" is true; this is an atomic operation per entity |
|
|
updateFirst(Query<T> query,
UpdateOperations<T> ops,
boolean createIfMissing,
com.mongodb.WriteConcern wc)
|
|
| Method Detail |
|---|
<T> Key<T> getKey(T entity)
DBRef
Key<?> exists(Object keyOrEntity)
<T,V> void delete(Class<T> clazz,
V id)
<T,V> void delete(Class<T> clazz,
Iterable<V> ids)
<T> void delete(Query<T> q)
<T> void delete(Query<T> q,
com.mongodb.WriteConcern wc)
<T> void delete(T entity)
<T> void delete(T entity,
com.mongodb.WriteConcern wc)
<T> Query<T> find(Class<T> clazz)
<T,V> Query<T> find(Class<T> clazz,
String property,
V value)
Find all instances by collectionName, and filter property.
This is the same as: find(clazzOrEntity).filter(property, value);
<T,V> Query<T> find(Class<T> clazz,
String property,
V value,
int offset,
int size)
Find all instances by collectionName, and filter property.
This is the same as: find(clazzOrEntity).filter(property, value).offset(offset).limit(size);
<T,V> Query<T> get(Class<T> clazz,
Iterable<V> ids)
find("_id in", ids)
<T,V> T get(Class<T> clazz,
V id)
find("_id ", id)
<T> T get(T entity)
<T> List<T> getByKeys(Class<T> clazz,
Iterable<Key<T>> keys)
find("_id in", ids)
<T> List<T> getByKeys(Iterable<Key<T>> keys)
find("_id in", ids)
<T> T getByKey(Class<T> clazz,
Key<T> key)
<T> long getCount(T entity)
DBCollection)
<T> long getCount(Class<T> clazz)
DBCollection)
<T> long getCount(Query<T> query)
query.countAll()
<T> Iterable<Key<T>> save(Iterable<T> entities)
<T> Iterable<Key<T>> save(Iterable<T> entities,
com.mongodb.WriteConcern wc)
<T> Iterable<Key<T>> save(T... entities)
<T> Key<T> save(T entity)
<T> Key<T> save(T entity,
com.mongodb.WriteConcern wc)
<T> Key<T> merge(T entity)
<T> Key<T> merge(T entity,
com.mongodb.WriteConcern wc)
<T> UpdateResults<T> update(T ent,
UpdateOperations<T> ops)
<T> UpdateResults<T> update(Key<T> key,
UpdateOperations<T> ops)
<T> UpdateResults<T> update(Query<T> query,
UpdateOperations<T> ops)
<T> UpdateResults<T> update(Query<T> query,
UpdateOperations<T> ops,
boolean createIfMissing)
<T> UpdateResults<T> update(Query<T> query,
UpdateOperations<T> ops,
boolean createIfMissing,
com.mongodb.WriteConcern wc)
<T> UpdateResults<T> updateFirst(Query<T> query,
UpdateOperations<T> ops)
<T> UpdateResults<T> updateFirst(Query<T> query,
UpdateOperations<T> ops,
boolean createIfMissing)
<T> UpdateResults<T> updateFirst(Query<T> query,
UpdateOperations<T> ops,
boolean createIfMissing,
com.mongodb.WriteConcern wc)
<T> UpdateResults<T> updateFirst(Query<T> query,
T entity,
boolean createIfMissing)
<T> T findAndDelete(Query<T> q)
<T> T findAndModify(Query<T> q,
UpdateOperations<T> ops)
<T> T findAndModify(Query<T> q,
UpdateOperations<T> ops,
boolean oldVersion)
q - the query to find the Entity with; You are not allowed to offset/skip in the query.oldVersion - indicated the old version of the Entity should be returned
<T> T findAndModify(Query<T> q,
UpdateOperations<T> ops,
boolean oldVersion,
boolean createIfMissing)
q - the query to find the Entity with; You are not allowed to offset/skip in the query.oldVersion - indicated the old version of the Entity should be returnedcreateIfMissing - if the query returns no results, then a new object will be created (sets upsert=true)
<T> MapreduceResults<T> mapReduce(MapreduceType type,
Query q,
String map,
String reduce,
String finalize,
Map<String,Object> scopeFields,
Class<T> outputType)
<T> UpdateOperations<T> createUpdateOperations(Class<T> kind)
<T> Query<T> createQuery(Class<T> kind)
DBCollection)
<T> void ensureIndex(Class<T> clazz,
String field,
IndexDirection dir)
@Deprecated
<T> void ensureIndex(Class<T> clazz,
IndexFieldDef... fields)
@Deprecated
<T> void ensureIndex(Class<T> clazz,
String name,
IndexFieldDef[] fields,
boolean unique,
boolean dropDupsOnCreate)
<T> void ensureIndex(Class<T> clazz,
String fields)
<T> void ensureIndex(Class<T> clazz,
String name,
String fields,
boolean unique,
boolean dropDupsOnCreate)
void ensureIndexes()
@Indexed, @Indexes)
void ensureIndexes(boolean background)
@Indexed, @Indexes), possibly in the background
<T> void ensureIndexes(Class<T> clazz)
@Indexed, @Indexes)
<T> void ensureIndexes(Class<T> clazz,
boolean background)
@Indexed, @Indexes), possibly in the background
void ensureCaps()
Entity(s)
com.mongodb.DB getDB()
com.mongodb.Mongo getMongo()
com.mongodb.DBCollection getCollection(Class<?> c)
com.mongodb.WriteConcern getDefaultWriteConcern()
void setDefaultWriteConcern(com.mongodb.WriteConcern wc)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||