|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AdvancedDatastore
This interface exposes advanced Datastore
features, like interacting with DBObject and low-level options. It implements matching
methods from the Datastore
interface but with a specified kind (collection name), or raw types (DBObject).
Method Summary | ||
---|---|---|
|
createQuery(Class<T> kind,
DBObject q)
|
|
|
createQuery(String kind,
Class<T> clazz)
|
|
|
createQuery(String kind,
Class<T> clazz,
DBObject q)
|
|
|
createRef(Class<T> clazz,
V id)
Creates a reference to the entity (using the current DB -can be null-, the collectionName, and id) |
|
|
createRef(T entity)
Creates a reference to the entity (using the current DB -can be null-, the collectionName, and id) |
|
|
createUpdateOperations(Class<T> kind,
DBObject ops)
|
|
|
delete(String kind,
Class<T> clazz,
V id)
Deletes an entity of the given type T, with the given id , from the collection with the name in the kind param. |
|
|
delete(String kind,
Class<T> clazz,
V id,
WriteConcern wc)
Deletes an entity of the given type T, with the given id , from the collection with the name in the kind param. |
|
|
ensureIndex(String collName,
Class<T> clazz,
String fields)
Ensures (creating if necessary) the index including the field(s) + directions on the given collection name; eg fields = "field1, -field2" ({field1:1, field2:-1}) |
|
|
ensureIndex(String collName,
Class<T> clazz,
String name,
String fields,
boolean unique,
boolean dropDupsOnCreate)
Ensures (creating if necessary) the index including the field(s) + directions on the given collection name; eg fields = "field1, -field2" ({field1:1, field2:-1}) |
|
|
ensureIndexes(String collName,
Class<T> clazz)
Ensures (creating if necessary) the indexes found during class mapping (using @Indexed, @Indexes) on the given collection
name. |
|
|
ensureIndexes(String collName,
Class<T> clazz,
boolean background)
Ensures (creating if necessary) the indexes found during class mapping (using @Indexed, @Indexes) on the given collection
name, possibly in the background |
|
Key<?> |
exists(Object keyOrEntity,
ReadPreference readPreference)
|
|
|
find(String kind,
Class<T> clazz)
|
|
|
find(String kind,
Class<T> clazz,
String property,
V value,
int offset,
int size)
|
|
|
get(Class<T> clazz,
DBRef ref)
Find the given entity (by collectionName/id); |
|
|
get(String kind,
Class<T> clazz,
V id)
|
|
long |
getCount(String kind)
Gets the count this kind |
|
DBDecoderFactory |
getDecoderFact()
|
|
|
insert(Iterable<T> entities,
WriteConcern wc)
|
|
|
insert(String kind,
Iterable<T> entities)
|
|
|
insert(String kind,
Iterable<T> entities,
WriteConcern wc)
|
|
|
insert(String kind,
T entity)
|
|
|
insert(T... entities)
|
|
|
insert(T entity)
|
|
|
insert(T entity,
WriteConcern wc)
|
|
|
queryByExample(String kind,
T example)
Returns a new query based on the example object |
|
|
save(String kind,
T entity)
|
|
|
save(String kind,
T entity,
WriteConcern wc)
|
|
DBDecoderFactory |
setDecoderFact(DBDecoderFactory fact)
|
Methods inherited from interface org.mongodb.morphia.Datastore |
---|
createAggregation, createQuery, createUpdateOperations, delete, delete, delete, delete, delete, delete, ensureCaps, ensureIndex, ensureIndex, ensureIndexes, ensureIndexes, ensureIndexes, ensureIndexes, exists, find, find, find, findAndDelete, findAndModify, findAndModify, findAndModify, get, get, get, getByKey, getByKeys, getByKeys, getCollection, getCount, getCount, getCount, getDB, getDefaultWriteConcern, getKey, getMongo, getQueryFactory, mapReduce, mapReduce, merge, merge, queryByExample, save, save, save, save, save, setDefaultWriteConcern, setQueryFactory, update, update, update, update, update, updateFirst, updateFirst, updateFirst, updateFirst |
Method Detail |
---|
Key<?> exists(Object keyOrEntity, ReadPreference readPreference)
readPreference
- Uses the supplied ReadPreference for the check. If readPreference is null the preference is taken from the
annotation or uses the default preference.Datastore.exists(Object)
<T,V> DBRef createRef(Class<T> clazz, V id)
<T> DBRef createRef(T entity)
<T> T get(Class<T> clazz, DBRef ref)
long getCount(String kind)
<T,V> T get(String kind, Class<T> clazz, V id)
<T> Query<T> find(String kind, Class<T> clazz)
<T,V> Query<T> find(String kind, Class<T> clazz, String property, V value, int offset, int size)
<T> Key<T> save(String kind, T entity)
<T> Key<T> save(String kind, T entity, WriteConcern wc)
<T,V> WriteResult delete(String kind, Class<T> clazz, V id)
id
, from the collection with the name in the kind
param.
Validates the id
, checking it's the correct type for an ID for entities of type T
. The entity type clazz
is
used only for validation, not for filtering, therefore if you have entities of different types in the same collection (kind
),
this method will delete any entity with the given id
, regardless of its type.
T
- the entity typeV
- is the type of the ID, for example ObjectIdkind
- the collection nameclazz
- the Class of the entity to deleteid
- the value of the ID
<T,V> WriteResult delete(String kind, Class<T> clazz, V id, WriteConcern wc)
id
, from the collection with the name in the kind
param.
Validates the id
, checking it's the correct type for an ID for entities of type T
. The entity type clazz
is
used only for validation, not for filtering, therefore if you have entities of different types in the same collection (kind
),
this method will delete any entity with the given id
, regardless of its type.
T
- the entity typeV
- is the type of the ID, for example ObjectIdkind
- the collection nameclazz
- the Class of the entity to deleteid
- the value of the IDwc
- the WriteConcern for this operation
<T> Key<T> insert(String kind, T entity)
<T> Key<T> insert(T entity)
<T> Key<T> insert(T entity, WriteConcern wc)
<T> Iterable<Key<T>> insert(T... entities)
<T> Iterable<Key<T>> insert(Iterable<T> entities, WriteConcern wc)
<T> Iterable<Key<T>> insert(String kind, Iterable<T> entities)
<T> Iterable<Key<T>> insert(String kind, Iterable<T> entities, WriteConcern wc)
<T> Query<T> createQuery(String kind, Class<T> clazz)
kind
- the name of the collection that should be queriedclazz
- the class of objects to be returned
<T> Query<T> createQuery(Class<T> kind, DBObject q)
kind
- the class of objects to be returnedq
- the query which will be passed to a QueryFactory
<T> Query<T> createQuery(String kind, Class<T> clazz, DBObject q)
<T> Query<T> queryByExample(String kind, T example)
<T> UpdateOperations<T> createUpdateOperations(Class<T> kind, DBObject ops)
DBDecoderFactory setDecoderFact(DBDecoderFactory fact)
DBDecoderFactory getDecoderFact()
<T> void ensureIndexes(String collName, Class<T> clazz)
@Indexed, @Indexes)
on the given collection
name.
<T> void ensureIndexes(String collName, Class<T> clazz, boolean background)
@Indexed, @Indexes)
on the given collection
name, possibly in the background
<T> void ensureIndex(String collName, Class<T> clazz, String fields)
<T> void ensureIndex(String collName, Class<T> clazz, String name, String fields, boolean unique, boolean dropDupsOnCreate)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |