Package dev.morphia
Class DatastoreImpl
- java.lang.Object
-
- dev.morphia.DatastoreImpl
-
- All Implemented Interfaces:
AdvancedDatastore
,Datastore
@Deprecated public class DatastoreImpl extends java.lang.Object implements AdvancedDatastore
Deprecated.This is an internal implementation of a published API. No public alternative planned.A generic (type-safe) wrapper around mongodb collectionsDeveloper note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-
Constructor Summary
Constructors Constructor Description DatastoreImpl(Morphia morphia, com.mongodb.MongoClient mongoClient, java.lang.String dbName)
Deprecated.This is not meant to be directly instantiated by end user code.DatastoreImpl(Morphia morphia, Mapper mapper, com.mongodb.MongoClient mongoClient, java.lang.String dbName)
Deprecated.This is not meant to be directly instantiated by end user code.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DatastoreImpl
copy(java.lang.String database)
Deprecated.AggregationPipeline
createAggregation(java.lang.Class source)
Deprecated.Returns a new query bound to the kind (a specificDBCollection
)AggregationPipeline
createAggregation(java.lang.String collection, java.lang.Class<?> clazz)
Deprecated.Returns anAggregationPipeline
bound to the given collection and class.<T> Query<T>
createQuery(java.lang.Class<T> collection)
Deprecated.Returns a new query bound to the collection (a specificDBCollection
)<T> Query<T>
createQuery(java.lang.Class<T> clazz, com.mongodb.DBObject q)
Deprecated.<T> Query<T>
createQuery(java.lang.String collection, java.lang.Class<T> type)
Deprecated.<T> Query<T>
createQuery(java.lang.String collection, java.lang.Class<T> type, com.mongodb.DBObject q)
Deprecated.<T,V>
com.mongodb.DBRefcreateRef(java.lang.Class<T> clazz, V id)
Deprecated.Creates a reference to the entity (using the current DB -can be null-, the collectionName, and id)<T> com.mongodb.DBRef
createRef(T entity)
Deprecated.Creates a reference to the entity (using the current DB -can be null-, the collectionName, and id)<T> UpdateOperations<T>
createUpdateOperations(java.lang.Class<T> clazz)
Deprecated.The builder for all update operations<T> UpdateOperations<T>
createUpdateOperations(java.lang.Class<T> type, com.mongodb.DBObject ops)
Deprecated.Creates an UpdateOperations instance for the given type.<T> com.mongodb.WriteResult
delete(Query<T> query)
Deprecated.Deletes entities based on the query<T> com.mongodb.WriteResult
delete(Query<T> query, com.mongodb.WriteConcern wc)
Deprecated.Deletes entities based on the query, with the WriteConcern<T> com.mongodb.WriteResult
delete(Query<T> query, DeleteOptions options)
Deprecated.Deletes entities based on the query<T,V>
com.mongodb.WriteResultdelete(java.lang.Class<T> clazz, java.lang.Iterable<V> ids)
Deprecated.Deletes the given entities (by id)<T,V>
com.mongodb.WriteResultdelete(java.lang.Class<T> clazz, java.lang.Iterable<V> ids, DeleteOptions options)
Deprecated.Deletes the given entities (by id)<T,V>
com.mongodb.WriteResultdelete(java.lang.Class<T> clazz, V id)
Deprecated.Deletes the given entity (by id)<T,V>
com.mongodb.WriteResultdelete(java.lang.Class<T> clazz, V id, DeleteOptions options)
Deprecated.Deletes the given entity (by id)<T,V>
com.mongodb.WriteResultdelete(java.lang.String kind, java.lang.Class<T> clazz, V id)
Deprecated.Deletes an entity of the given type T, with the givenid
, from the collection with the name in thekind
param.<T,V>
com.mongodb.WriteResultdelete(java.lang.String kind, java.lang.Class<T> clazz, V id, com.mongodb.WriteConcern wc)
Deprecated.<T,V>
com.mongodb.WriteResultdelete(java.lang.String kind, java.lang.Class<T> clazz, V id, DeleteOptions options)
Deprecated.Deletes an entity of the given type T, with the givenid
, from the collection with the name in thekind
param.<T> com.mongodb.WriteResult
delete(T entity)
Deprecated.Deletes the given entity (by @Id)<T> com.mongodb.WriteResult
delete(T entity, com.mongodb.WriteConcern wc)
Deprecated.Deletes the given entity (by @Id), with the WriteConcern<T> com.mongodb.WriteResult
delete(T entity, DeleteOptions options)
Deprecated.Deletes the given entity (by @Id), with the WriteConcernvoid
enableDocumentValidation()
Deprecated.Process anyValidation
annotations for document validation.void
ensureCaps()
Deprecated.ensure capped collections forEntity
(s)<T> void
ensureIndex(java.lang.Class<T> type, java.lang.String fields)
Deprecated.<T> void
ensureIndex(java.lang.Class<T> clazz, java.lang.String name, java.lang.String fields, boolean unique, boolean dropDupsOnCreate)
Deprecated.<T> void
ensureIndex(java.lang.String collection, java.lang.Class<T> type, java.lang.String fields)
Deprecated.<T> void
ensureIndex(java.lang.String collection, java.lang.Class<T> clazz, java.lang.String name, java.lang.String fields, boolean unique, boolean dropDupsOnCreate)
Deprecated.void
ensureIndexes()
Deprecated.Ensures (creating if necessary) the indexes found during class mappingvoid
ensureIndexes(boolean background)
Deprecated.Ensures (creating if necessary) the indexes found during class mapping (using@Indexed, @Indexes)
on the given collection name, possibly in the background<T> void
ensureIndexes(java.lang.Class<T> clazz)
Deprecated.Ensures (creating if necessary) the indexes found during class mapping<T> void
ensureIndexes(java.lang.Class<T> clazz, boolean background)
Deprecated.Ensures (creating if necessary) the indexes found during class mapping<T> void
ensureIndexes(java.lang.String collection, java.lang.Class<T> clazz)
Deprecated.Ensures (creating if necessary) the indexes found during class mapping (using@Indexed, @Indexes)
on the given collection name.<T> void
ensureIndexes(java.lang.String collection, java.lang.Class<T> clazz, boolean background)
Deprecated.Ensures (creating if necessary) the indexes found during class mapping (using@Indexed, @Indexes)
on the given collection name, possibly in the backgroundKey<?>
exists(java.lang.Object entityOrKey)
Deprecated.Does a query to check if the keyOrEntity exists in mongodbKey<?>
exists(java.lang.Object entityOrKey, com.mongodb.ReadPreference readPreference)
Deprecated.Checks that an entity exists for the given key or entity<T> Query<T>
find(java.lang.Class<T> clazz)
Deprecated.Find all instances by type<T,V>
Query<T>find(java.lang.Class<T> clazz, java.lang.String property, V value)
Deprecated.<T,V>
Query<T>find(java.lang.Class<T> clazz, java.lang.String property, V value, int offset, int size)
Deprecated.<T> Query<T>
find(java.lang.String collection, java.lang.Class<T> clazz)
Deprecated.Find all instances by type in a different collection than what is mapped on the class given.<T,V>
Query<T>find(java.lang.String collection, java.lang.Class<T> clazz, java.lang.String property, V value, int offset, int size)
Deprecated.Find all instances by type in a different collection than what is mapped on the class given skipping some documents and returning a fixed number of the remaining.<T,V>
Query<T>find(java.lang.String collection, java.lang.Class<T> clazz, java.lang.String property, V value, int offset, int size, boolean validate)
Deprecated.Find all instances by type in a different collection than what is mapped on the class given skipping some documents and returning a fixed number of the remaining.<T> T
findAndDelete(Query<T> query)
Deprecated.Deletes the given entities based on the query (first item only).<T> T
findAndDelete(Query<T> query, FindAndModifyOptions options)
Deprecated.Deletes the given entities based on the query (first item only).<T> T
findAndModify(Query<T> query, UpdateOperations<T> operations)
Deprecated.Find the first Entity from the Query, and modify it.<T> T
findAndModify(Query<T> query, UpdateOperations<T> operations, boolean oldVersion)
Deprecated.<T> T
findAndModify(Query<T> query, UpdateOperations<T> operations, boolean oldVersion, boolean createIfMissing)
Deprecated.<T> T
findAndModify(Query<T> query, UpdateOperations<T> operations, FindAndModifyOptions options)
Deprecated.Find the first Entity from the Query, and modify it.<T> T
get(java.lang.Class<T> clazz, com.mongodb.DBRef ref)
Deprecated.Find the given entity (by collectionName/id);<T,V>
Query<T>get(java.lang.Class<T> clazz, java.lang.Iterable<V> ids)
Deprecated.Find the given entities (by id); shorthand forfind("_id in", ids)
<T,V>
Tget(java.lang.Class<T> clazz, V id)
Deprecated.Find the given entity (by id); shorthand forfind("_id ", id)
<T,V>
Tget(java.lang.String collection, java.lang.Class<T> clazz, V id)
Deprecated.Finds an entity in the named collection whose id matches the value given.<T> T
get(T entity)
Deprecated.Find the given entity (by collectionName/id); think of this as refresh<T> T
getByKey(java.lang.Class<T> clazz, Key<T> key)
Deprecated.Find the given entity (by collectionName/id);<T> java.util.List<T>
getByKeys(java.lang.Class<T> clazz, java.lang.Iterable<Key<T>> keys)
Deprecated.Find the given entities (by id), verifying they are of the correct type; shorthand forfind("_id in", ids)
<T> java.util.List<T>
getByKeys(java.lang.Iterable<Key<T>> keys)
Deprecated.Find the given entities (by id); shorthand forfind("_id in", ids)
com.mongodb.DBCollection
getCollection(java.lang.Class clazz)
Deprecated.com.mongodb.DBCollection
getCollection(java.lang.Object obj)
Deprecated.this is an internal method.<T> long
getCount(Query<T> query)
Deprecated.Gets the count of items returned by this query; same asquery.countAll()
<T> long
getCount(Query<T> query, CountOptions options)
Deprecated.Gets the count of items returned by this query; same asquery.countAll()
<T> long
getCount(java.lang.Class<T> clazz)
Deprecated.Gets the count this kind (DBCollection
)long
getCount(java.lang.String collection)
Deprecated.Gets the count this collection<T> long
getCount(T entity)
Deprecated.Gets the count this kind (DBCollection
)com.mongodb.client.MongoDatabase
getDatabase()
Deprecated.com.mongodb.DB
getDB()
Deprecated.com.mongodb.DBDecoderFactory
getDecoderFact()
Deprecated.Returns the DBDecoderFactory used by this Datastorecom.mongodb.WriteConcern
getDefaultWriteConcern()
Deprecated.protected java.lang.Object
getId(java.lang.Object entity)
Deprecated.<T> Key<T>
getKey(T entity)
Deprecated.Mapper
getMapper()
Deprecated.com.mongodb.MongoClient
getMongo()
Deprecated.Get the underlying MongoClient that allows connection to the MongoDB instance being used.QueryFactory
getQueryFactory()
Deprecated.protected <T> Key<T>
insert(com.mongodb.DBCollection dbColl, T entity, InsertOptions options)
Deprecated.<T> java.lang.Iterable<Key<T>>
insert(java.lang.Iterable<T> entities)
Deprecated.Inserts entities in to the database<T> java.lang.Iterable<Key<T>>
insert(java.lang.Iterable<T> entities, com.mongodb.WriteConcern wc)
Deprecated.Inserts entities in to the mapped collection.<T> java.lang.Iterable<Key<T>>
insert(java.lang.Iterable<T> entities, InsertOptions options)
Deprecated.Inserts entities in to the mapped collection.<T> java.lang.Iterable<Key<T>>
insert(java.lang.String collection, java.lang.Iterable<T> entities)
Deprecated.Inserts an entity in to the named collection.<T> java.lang.Iterable<Key<T>>
insert(java.lang.String collection, java.lang.Iterable<T> entities, com.mongodb.WriteConcern wc)
Deprecated.Inserts an entity in to the named collection.<T> java.lang.Iterable<Key<T>>
insert(java.lang.String collection, java.lang.Iterable<T> entities, InsertOptions options)
Deprecated.Inserts entities in to the named collection.<T> Key<T>
insert(java.lang.String collection, T entity)
Deprecated.Inserts an entity in to the named collection.<T> Key<T>
insert(java.lang.String collection, T entity, com.mongodb.WriteConcern wc)
Deprecated.Inserts an entity in to the database<T> Key<T>
insert(java.lang.String collection, T entity, InsertOptions options)
Deprecated.Inserts an entity in to the named collection.<T> java.lang.Iterable<Key<T>>
insert(java.util.List<T> entities)
Deprecated.Inserts entities in to the database<T> java.util.List<Key<T>>
insert(java.util.List<T> entities, InsertOptions options)
Deprecated.Inserts entities in to the mapped collection.<T> Key<T>
insert(T entity)
Deprecated.Inserts an entity in to the mapped collection.<T> java.lang.Iterable<Key<T>>
insert(T... entities)
Deprecated.<T> Key<T>
insert(T entity, com.mongodb.WriteConcern wc)
Deprecated.Inserts an entity in to the mapped collection.<T> Key<T>
insert(T entity, InsertOptions options)
Deprecated.Inserts an entity in to the mapped collection.<T> MapreduceResults<T>
mapReduce(MapReduceOptions<T> options)
Deprecated.Runs a map/reduce job at the server<T> MapreduceResults<T>
mapReduce(MapreduceType type, Query query, java.lang.Class<T> outputType, com.mongodb.MapReduceCommand baseCommand)
Deprecated.<T> MapreduceResults<T>
mapReduce(MapreduceType type, Query query, java.lang.String map, java.lang.String reduce, java.lang.String finalize, java.util.Map<java.lang.String,java.lang.Object> scopeFields, java.lang.Class<T> outputType)
Deprecated.<T> Key<T>
merge(T entity)
Deprecated.Work as if you did an update with each field in the entity doing a $set; Only at the top level of the entity.<T> Key<T>
merge(T entity, com.mongodb.WriteConcern wc)
Deprecated.Work as if you did an update with each field in the entity doing a $set; Only at the top level of the entity.<T> Query<T>
queryByExample(java.lang.String collection, T ex)
Deprecated.Returns a new query based on the example object<T> Query<T>
queryByExample(T ex)
Deprecated.Returns a new query based on the example objectprotected <T> Key<T>
save(com.mongodb.DBCollection dbColl, T entity, InsertOptions options)
Deprecated.<T> java.lang.Iterable<Key<T>>
save(java.lang.Iterable<T> entities)
Deprecated.Saves the entities (Objects) and updates the @Id field The return type will change in 2.0<T> java.lang.Iterable<Key<T>>
save(java.lang.Iterable<T> entities, com.mongodb.WriteConcern wc)
Deprecated.Saves the entities (Objects) and updates the @Id field, with the WriteConcern<T> java.lang.Iterable<Key<T>>
save(java.lang.Iterable<T> entities, InsertOptions options)
Deprecated.Saves the entities (Objects) and updates the @Id field, with the WriteConcern The return type will change in 2.0<T> Key<T>
save(java.lang.String collection, T entity)
Deprecated.Saves an entity in to the named collection.<T> Key<T>
save(java.lang.String collection, T entity, com.mongodb.WriteConcern wc)
Deprecated.Saves an entity in to the named collection.<T> Key<T>
save(java.lang.String collection, T entity, InsertOptions options)
Deprecated.Saves an entity in to the named collection.<T> Key<T>
save(T entity)
Deprecated.Saves an entity (Object) and updates the @Id field The return type will change in 2.0<T> java.lang.Iterable<Key<T>>
save(T... entities)
Deprecated.<T> Key<T>
save(T entity, com.mongodb.WriteConcern wc)
Deprecated.<T> Key<T>
save(T entity, InsertOptions options)
Deprecated.Saves an entity (Object) and updates the @Id field The return type will change in 2.0void
setDecoderFact(com.mongodb.DBDecoderFactory fact)
Deprecated.Sets the DBDecoderFactory to use in this Datastorevoid
setDefaultWriteConcern(com.mongodb.WriteConcern wc)
Deprecated.Sets the default WriteConcern for this Datastorevoid
setMapper(Mapper mapper)
Deprecated.Sets the Mapper this Datastore usesvoid
setQueryFactory(QueryFactory queryFactory)
Deprecated.Replaces the currentQueryFactory
with the given value.<T> UpdateResults
update(Key<T> key, UpdateOperations<T> operations)
Deprecated.Updates an entity with the operations; this is an atomic operation<T> UpdateResults
update(Query<T> query, UpdateOperations<T> operations)
Deprecated.Updates all entities found with the operations; this is an atomic operation per entity<T> UpdateResults
update(Query<T> query, UpdateOperations<T> operations, boolean createIfMissing)
Deprecated.<T> UpdateResults
update(Query<T> query, UpdateOperations<T> operations, boolean createIfMissing, com.mongodb.WriteConcern wc)
Deprecated.<T> UpdateResults
update(Query<T> query, UpdateOperations<T> operations, UpdateOptions options)
Deprecated.Updates all entities found with the operations; this is an atomic operation per entity<T> UpdateResults
update(T entity, UpdateOperations<T> operations)
Deprecated.Updates an entity with the operations; this is an atomic operation<T> UpdateResults
updateFirst(Query<T> query, UpdateOperations<T> operations)
Deprecated.<T> UpdateResults
updateFirst(Query<T> query, UpdateOperations<T> operations, boolean createIfMissing)
Deprecated.<T> UpdateResults
updateFirst(Query<T> query, UpdateOperations<T> operations, boolean createIfMissing, com.mongodb.WriteConcern wc)
Deprecated.<T> UpdateResults
updateFirst(Query<T> query, T entity, boolean createIfMissing)
Deprecated.
-
-
-
Constructor Detail
-
DatastoreImpl
@Deprecated public DatastoreImpl(Morphia morphia, com.mongodb.MongoClient mongoClient, java.lang.String dbName)
Deprecated.This is not meant to be directly instantiated by end user code. UseMorphia.createDatastore(MongoClient, Mapper, String)
Create a new DatastoreImpl- Parameters:
morphia
- the Morphia instancemongoClient
- the connection to the MongoDB instancedbName
- the name of the database for this data store.
-
DatastoreImpl
@Deprecated public DatastoreImpl(Morphia morphia, Mapper mapper, com.mongodb.MongoClient mongoClient, java.lang.String dbName)
Deprecated.This is not meant to be directly instantiated by end user code. UseMorphia.createDatastore(MongoClient, Mapper, String)
Create a new DatastoreImpl- Parameters:
morphia
- the Morphia instancemapper
- an initialised MappermongoClient
- the connection to the MongoDB instancedbName
- the name of the database for this data store.
-
-
Method Detail
-
copy
@Deprecated public DatastoreImpl copy(java.lang.String database)
Deprecated.Creates a copy of this Datastore and all its configuration but with a new database- Parameters:
database
- the new database to use for operations- Returns:
- the new Datastore instance
-
createAggregation
public AggregationPipeline createAggregation(java.lang.Class source)
Deprecated.Description copied from interface:Datastore
Returns a new query bound to the kind (a specificDBCollection
)- Specified by:
createAggregation
in interfaceDatastore
- Parameters:
source
- the initial type/collection to aggregate against- Returns:
- a new query bound to the kind (a specific
DBCollection
)
-
createAggregation
public AggregationPipeline createAggregation(java.lang.String collection, java.lang.Class<?> clazz)
Deprecated.Description copied from interface:AdvancedDatastore
Returns anAggregationPipeline
bound to the given collection and class.- Specified by:
createAggregation
in interfaceAdvancedDatastore
- Parameters:
collection
- the collection to queryclazz
- The class to create aggregation against- Returns:
- the aggregation pipeline
-
createQuery
public <T> Query<T> createQuery(java.lang.Class<T> collection)
Deprecated.Description copied from interface:Datastore
Returns a new query bound to the collection (a specificDBCollection
)- Specified by:
createQuery
in interfaceDatastore
- Type Parameters:
T
- the type of the query- Parameters:
collection
- The collection to query- Returns:
- the query
-
createUpdateOperations
public <T> UpdateOperations<T> createUpdateOperations(java.lang.Class<T> clazz)
Deprecated.Description copied from interface:Datastore
The builder for all update operations- Specified by:
createUpdateOperations
in interfaceDatastore
- Type Parameters:
T
- the type to update- Parameters:
clazz
- the type to update- Returns:
- the new UpdateOperations instance
-
delete
public <T> com.mongodb.WriteResult delete(Query<T> query, DeleteOptions options)
Deprecated.Description copied from interface:Datastore
Deletes entities based on the query
-
delete
public <T,V> com.mongodb.WriteResult delete(java.lang.Class<T> clazz, V id)
Deprecated.Description copied from interface:Datastore
Deletes the given entity (by id)
-
delete
public <T,V> com.mongodb.WriteResult delete(java.lang.Class<T> clazz, V id, DeleteOptions options)
Deprecated.Description copied from interface:Datastore
Deletes the given entity (by id)
-
delete
public <T,V> com.mongodb.WriteResult delete(java.lang.Class<T> clazz, java.lang.Iterable<V> ids)
Deprecated.Description copied from interface:Datastore
Deletes the given entities (by id)
-
delete
public <T,V> com.mongodb.WriteResult delete(java.lang.Class<T> clazz, java.lang.Iterable<V> ids, DeleteOptions options)
Deprecated.Description copied from interface:Datastore
Deletes the given entities (by id)
-
delete
public <T> com.mongodb.WriteResult delete(Query<T> query)
Deprecated.Description copied from interface:Datastore
Deletes entities based on the query
-
delete
public <T> com.mongodb.WriteResult delete(Query<T> query, com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:Datastore
Deletes entities based on the query, with the WriteConcern
-
delete
public <T> com.mongodb.WriteResult delete(T entity)
Deprecated.Description copied from interface:Datastore
Deletes the given entity (by @Id)
-
delete
public <T> com.mongodb.WriteResult delete(T entity, com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:Datastore
Deletes the given entity (by @Id), with the WriteConcern
-
delete
public <T> com.mongodb.WriteResult delete(T entity, DeleteOptions options)
Deprecated.Deletes the given entity (by @Id), with the WriteConcern
-
ensureCaps
public void ensureCaps()
Deprecated.Description copied from interface:Datastore
ensure capped collections forEntity
(s)- Specified by:
ensureCaps
in interfaceDatastore
-
enableDocumentValidation
public void enableDocumentValidation()
Deprecated.Description copied from interface:Datastore
Process anyValidation
annotations for document validation.- Specified by:
enableDocumentValidation
in interfaceDatastore
-
exists
public Key<?> exists(java.lang.Object entityOrKey)
Deprecated.Description copied from interface:Datastore
Does a query to check if the keyOrEntity exists in mongodb
-
find
public <T> Query<T> find(java.lang.Class<T> clazz)
Deprecated.Description copied from interface:Datastore
Find all instances by type
-
find
@Deprecated public <T,V> Query<T> find(java.lang.Class<T> clazz, java.lang.String property, V value)
Deprecated.Description copied from interface:Datastore
Find all instances by collectionName, and filter property.
This is the same as:
find(clazzOrEntity).filter (property, value);
-
find
@Deprecated public <T,V> Query<T> find(java.lang.Class<T> clazz, java.lang.String property, V value, int offset, int size)
Deprecated.Description copied from interface:Datastore
Find all instances by type in a different collection than what is mapped on the class given skipping some documents and returning a fixed number of the remaining.- Specified by:
find
in interfaceDatastore
- Type Parameters:
T
- the type to queryV
- the type to filter value- Parameters:
clazz
- the class to use for mapping the resultsproperty
- the document property to query againstvalue
- the value to check foroffset
- the number of results to skipsize
- the maximum number of results to return- Returns:
- the query
-
findAndDelete
public <T> T findAndDelete(Query<T> query)
Deprecated.Description copied from interface:Datastore
Deletes the given entities based on the query (first item only).- Specified by:
findAndDelete
in interfaceDatastore
- Type Parameters:
T
- the type to query- Parameters:
query
- the query to use when finding entities to delete- Returns:
- the deleted Entity
-
findAndDelete
public <T> T findAndDelete(Query<T> query, FindAndModifyOptions options)
Deprecated.Description copied from interface:Datastore
Deletes the given entities based on the query (first item only).- Specified by:
findAndDelete
in interfaceDatastore
- Type Parameters:
T
- the type to query- Parameters:
query
- the query to use when finding entities to deleteoptions
- the options to apply to the delete- Returns:
- the deleted Entity
-
findAndModify
public <T> T findAndModify(Query<T> query, UpdateOperations<T> operations, FindAndModifyOptions options)
Deprecated.Description copied from interface:Datastore
Find the first Entity from the Query, and modify it.- Specified by:
findAndModify
in interfaceDatastore
- Type Parameters:
T
- the type to query- Parameters:
query
- the query to use when finding entities to updateoperations
- the updates to apply to the matched documentsoptions
- the options to apply to the update- Returns:
- The modified Entity (the result of the update)
-
findAndModify
public <T> T findAndModify(Query<T> query, UpdateOperations<T> operations)
Deprecated.Description copied from interface:Datastore
Find the first Entity from the Query, and modify it.- Specified by:
findAndModify
in interfaceDatastore
- Type Parameters:
T
- the type to query- Parameters:
query
- the query to use when finding entities to updateoperations
- the updates to apply to the matched documents- Returns:
- The modified Entity (the result of the update)
-
findAndModify
@Deprecated public <T> T findAndModify(Query<T> query, UpdateOperations<T> operations, boolean oldVersion)
Deprecated.Description copied from interface:Datastore
Find the first Entity from the Query, and modify it.- Specified by:
findAndModify
in interfaceDatastore
- Type Parameters:
T
- the type to query- Parameters:
query
- the query to find the Entity with; You are not allowed to offset/skip in the query.operations
- the updates to apply to the matched documentsoldVersion
- indicated the old version of the Entity should be returned- Returns:
- The Entity (the result of the update if oldVersion is false)
-
findAndModify
@Deprecated public <T> T findAndModify(Query<T> query, UpdateOperations<T> operations, boolean oldVersion, boolean createIfMissing)
Deprecated.Description copied from interface:Datastore
Find the first Entity from the Query, and modify it.- Specified by:
findAndModify
in interfaceDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
query
- the query to find the Entity with; You are not allowed to offset/skip in the query.operations
- the updates to apply to the matched documentsoldVersion
- 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)- Returns:
- The Entity (the result of the update if oldVersion is false)
-
get
public <T,V> Query<T> get(java.lang.Class<T> clazz, java.lang.Iterable<V> ids)
Deprecated.Description copied from interface:Datastore
Find the given entities (by id); shorthand forfind("_id in", ids)
-
get
public <T,V> T get(java.lang.Class<T> clazz, V id)
Deprecated.Description copied from interface:Datastore
Find the given entity (by id); shorthand forfind("_id ", id)
-
get
public <T> T get(T entity)
Deprecated.Description copied from interface:Datastore
Find the given entity (by collectionName/id); think of this as refresh
-
getByKey
public <T> T getByKey(java.lang.Class<T> clazz, Key<T> key)
Deprecated.Description copied from interface:Datastore
Find the given entity (by collectionName/id);
-
getByKeys
public <T> java.util.List<T> getByKeys(java.lang.Class<T> clazz, java.lang.Iterable<Key<T>> keys)
Deprecated.Description copied from interface:Datastore
Find the given entities (by id), verifying they are of the correct type; shorthand forfind("_id in", ids)
-
getByKeys
public <T> java.util.List<T> getByKeys(java.lang.Iterable<Key<T>> keys)
Deprecated.Description copied from interface:Datastore
Find the given entities (by id); shorthand forfind("_id in", ids)
-
getCollection
@Deprecated public com.mongodb.DBCollection getCollection(java.lang.Object obj)
Deprecated.this is an internal method. no replacement is planned.- Parameters:
obj
- the value to search with- Returns:
- the DBCollection
-
getCollection
public com.mongodb.DBCollection getCollection(java.lang.Class clazz)
Deprecated.- Specified by:
getCollection
in interfaceDatastore
- Parameters:
clazz
- the class to use for mapping- Returns:
- the mapped collection for the collection
-
getCount
public <T> long getCount(T entity)
Deprecated.Description copied from interface:Datastore
Gets the count this kind (DBCollection
)
-
getCount
public <T> long getCount(java.lang.Class<T> clazz)
Deprecated.Description copied from interface:Datastore
Gets the count this kind (DBCollection
)
-
getCount
public <T> long getCount(Query<T> query)
Deprecated.Description copied from interface:Datastore
Gets the count of items returned by this query; same asquery.countAll()
-
getCount
public <T> long getCount(Query<T> query, CountOptions options)
Deprecated.Description copied from interface:Datastore
Gets the count of items returned by this query; same asquery.countAll()
-
getDB
public com.mongodb.DB getDB()
Deprecated.
-
getDatabase
public com.mongodb.client.MongoDatabase getDatabase()
Deprecated.- Specified by:
getDatabase
in interfaceDatastore
- Returns:
- the MongoDatabase used by this DataStore
-
getDefaultWriteConcern
public com.mongodb.WriteConcern getDefaultWriteConcern()
Deprecated.- Specified by:
getDefaultWriteConcern
in interfaceDatastore
- Returns:
- the default WriteConcern used by this Datastore
-
setDefaultWriteConcern
public void setDefaultWriteConcern(com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:Datastore
Sets the default WriteConcern for this Datastore- Specified by:
setDefaultWriteConcern
in interfaceDatastore
- Parameters:
wc
- the default WriteConcern to be used by this Datastore
-
getKey
@Deprecated public <T> Key<T> getKey(T entity)
Deprecated.Description copied from interface:Datastore
Creates a (type-safe) reference to the entity; if stored this will become aDBRef
-
getMongo
public com.mongodb.MongoClient getMongo()
Deprecated.Description copied from interface:Datastore
Get the underlying MongoClient that allows connection to the MongoDB instance being used.
-
getQueryFactory
public QueryFactory getQueryFactory()
Deprecated.- Specified by:
getQueryFactory
in interfaceDatastore
- Returns:
- the current
QueryFactory
. - See Also:
QueryFactory
-
setQueryFactory
public void setQueryFactory(QueryFactory queryFactory)
Deprecated.Description copied from interface:Datastore
Replaces the currentQueryFactory
with the given value.- Specified by:
setQueryFactory
in interfaceDatastore
- Parameters:
queryFactory
- the QueryFactory to use- See Also:
QueryFactory
-
mapReduce
public <T> MapreduceResults<T> mapReduce(MapReduceOptions<T> options)
Deprecated.Description copied from interface:Datastore
Runs a map/reduce job at the server
-
mapReduce
@Deprecated public <T> MapreduceResults<T> mapReduce(MapreduceType type, Query query, java.lang.String map, java.lang.String reduce, java.lang.String finalize, java.util.Map<java.lang.String,java.lang.Object> scopeFields, java.lang.Class<T> outputType)
Deprecated.Description copied from interface:Datastore
Runs a map/reduce job at the server; this should be used with a server version 1.7.4 or higher- Specified by:
mapReduce
in interfaceDatastore
- Type Parameters:
T
- The type of resulting data- Parameters:
type
- MapreduceTypequery
- The query (only the criteria, limit and sort will be used)map
- The map function, in javascript, as a stringreduce
- The reduce function, in javascript, as a stringfinalize
- The finalize function, in javascript, as a string; can be nullscopeFields
- Each map entry will be a global variable in all the functions; can be nulloutputType
- The type of resulting data; inline is not working yet- Returns:
- counts and stuff
-
mapReduce
@Deprecated public <T> MapreduceResults<T> mapReduce(MapreduceType type, Query query, java.lang.Class<T> outputType, com.mongodb.MapReduceCommand baseCommand)
Deprecated.Description copied from interface:Datastore
Runs a map/reduce job at the server; this should be used with a server version 1.7.4 or higher- Specified by:
mapReduce
in interfaceDatastore
- Type Parameters:
T
- The type of resulting data- Parameters:
type
- MapreduceTypequery
- The query (only the criteria, limit and sort will be used)outputType
- The type of resulting data; inline is not working yetbaseCommand
- The base command to fill in and send to the server- Returns:
- counts and stuff
-
merge
public <T> Key<T> merge(T entity)
Deprecated.Description copied from interface:Datastore
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
public <T> Key<T> merge(T entity, com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:Datastore
Work as if you did an update with each field in the entity doing a $set; Only at the top level of the entity.
-
queryByExample
public <T> Query<T> queryByExample(T ex)
Deprecated.Description copied from interface:Datastore
Returns a new query based on the example object- Specified by:
queryByExample
in interfaceDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
ex
- the example entity to use when creating the query- Returns:
- the query
-
insert
public <T> java.lang.Iterable<Key<T>> insert(java.util.List<T> entities)
Deprecated.Inserts entities in to the database- Specified by:
insert
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entities- Parameters:
entities
- the entities to insert- Returns:
- the keys of entities
-
save
public <T> java.lang.Iterable<Key<T>> save(java.lang.Iterable<T> entities, com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:Datastore
Saves the entities (Objects) and updates the @Id field, with the WriteConcern
-
save
public <T> java.lang.Iterable<Key<T>> save(java.lang.Iterable<T> entities, InsertOptions options)
Deprecated.Description copied from interface:Datastore
Saves the entities (Objects) and updates the @Id field, with the WriteConcern The return type will change in 2.0
-
save
@Deprecated public <T> java.lang.Iterable<Key<T>> save(T... entities)
Deprecated.Description copied from interface:Datastore
Saves the entities (Objects) and updates the @Id field
-
save
public <T> Key<T> save(T entity)
Deprecated.Description copied from interface:Datastore
Saves an entity (Object) and updates the @Id field The return type will change in 2.0
-
save
@Deprecated public <T> Key<T> save(T entity, com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:Datastore
Saves an entity (Object) and updates the @Id field, with the WriteConcern
-
save
public <T> Key<T> save(T entity, InsertOptions options)
Deprecated.Description copied from interface:Datastore
Saves an entity (Object) and updates the @Id field The return type will change in 2.0
-
update
public <T> UpdateResults update(T entity, UpdateOperations<T> operations)
Deprecated.Description copied from interface:Datastore
Updates an entity with the operations; this is an atomic operation- Specified by:
update
in interfaceDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
entity
- the entity to updateoperations
- the update operations to perform- Returns:
- the update results
- See Also:
UpdateResults
-
update
public <T> UpdateResults update(Key<T> key, UpdateOperations<T> operations)
Deprecated.Description copied from interface:Datastore
Updates an entity with the operations; this is an atomic operation- Specified by:
update
in interfaceDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
key
- the key of entity to updateoperations
- the update operations to perform- Returns:
- the update results
- See Also:
UpdateResults
-
update
public <T> UpdateResults update(Query<T> query, UpdateOperations<T> operations)
Deprecated.Description copied from interface:Datastore
Updates all entities found with the operations; this is an atomic operation per entity
-
update
@Deprecated public <T> UpdateResults update(Query<T> query, UpdateOperations<T> operations, boolean createIfMissing)
Deprecated.Description copied from interface:Datastore
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- Specified by:
update
in interfaceDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
query
- the query used to match the documents to updateoperations
- the update operations to performcreateIfMissing
- if true, a document will be created if none can be found that match the query- Returns:
- the results of the updates
-
update
@Deprecated public <T> UpdateResults update(Query<T> query, UpdateOperations<T> operations, boolean createIfMissing, com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:Datastore
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- Specified by:
update
in interfaceDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
query
- the query used to match the documents to updateoperations
- the update operations to performcreateIfMissing
- if true, a document will be created if none can be found that match the querywc
- the WriteConcern to use- Returns:
- the results of the updates
-
updateFirst
@Deprecated public <T> UpdateResults updateFirst(Query<T> query, UpdateOperations<T> operations)
Deprecated.Description copied from interface:Datastore
Updates the first entity found with the operations; this is an atomic operation- Specified by:
updateFirst
in interfaceDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
query
- the query used to match the document to updateoperations
- the update operations to perform- Returns:
- the results of the update
-
updateFirst
@Deprecated public <T> UpdateResults updateFirst(Query<T> query, UpdateOperations<T> operations, boolean createIfMissing)
Deprecated.Description copied from interface:Datastore
Updates the first entity found with the operations, if nothing is found insert the update as an entity if "createIfMissing" is true.- Specified by:
updateFirst
in interfaceDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
query
- the query used to match the documents to updateoperations
- the update operations to performcreateIfMissing
- if true, a document will be created if none can be found that match the query- Returns:
- the results of the updates
-
updateFirst
@Deprecated public <T> UpdateResults updateFirst(Query<T> query, UpdateOperations<T> operations, boolean createIfMissing, com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:Datastore
Updates the first entity found with the operations, if nothing is found insert the update as an entity if "createIfMissing" is true.- Specified by:
updateFirst
in interfaceDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
query
- the query used to match the documents to updateoperations
- the update operations to performcreateIfMissing
- if true, a document will be created if none can be found that match the querywc
- the WriteConcern to use- Returns:
- the results of the updates
-
updateFirst
@Deprecated public <T> UpdateResults updateFirst(Query<T> query, T entity, boolean createIfMissing)
Deprecated.Description copied from interface:Datastore
updates the first entity found using the entity as a template, if nothing is found insert the update as an entity if "createIfMissing" is true.If the entity is a versioned entity, an UnsupportedOperationException is thrown.
- Specified by:
updateFirst
in interfaceDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
query
- the query used to match the documents to updateentity
- the entity whose state will be used as an update template for any matching documentscreateIfMissing
- if true, a document will be created if none can be found that match the query- Returns:
- the results of the updates
-
createQuery
public <T> Query<T> createQuery(java.lang.String collection, java.lang.Class<T> type)
Deprecated.- Specified by:
createQuery
in interfaceAdvancedDatastore
- Type Parameters:
T
- The type of the entity- Parameters:
collection
- the collection to querytype
- the class of objects to be returned- Returns:
- Query for the specified class clazz
-
createQuery
public <T> Query<T> createQuery(java.lang.Class<T> clazz, com.mongodb.DBObject q)
Deprecated.- Specified by:
createQuery
in interfaceAdvancedDatastore
- Type Parameters:
T
- The type of the entity- Parameters:
clazz
- the class of objects to be returnedq
- the query which will be passed to aQueryFactory
- Returns:
- Query for the specified class clazz
-
createQuery
public <T> Query<T> createQuery(java.lang.String collection, java.lang.Class<T> type, com.mongodb.DBObject q)
Deprecated.- Specified by:
createQuery
in interfaceAdvancedDatastore
- Type Parameters:
T
- The type of the entity- Parameters:
collection
- the collection to querytype
- the class of objects to be returnedq
- the query which will be passed to aQueryFactory
- Returns:
- Query for the specified class clazz
-
createRef
public <T,V> com.mongodb.DBRef createRef(java.lang.Class<T> clazz, V id)
Deprecated.Description copied from interface:AdvancedDatastore
Creates a reference to the entity (using the current DB -can be null-, the collectionName, and id)- Specified by:
createRef
in interfaceAdvancedDatastore
- Type Parameters:
T
- The type of the entityV
- The type of the ID value- Parameters:
clazz
- The type of the entityid
- The ID value of the entity- Returns:
- the DBRef for the entity
-
createRef
public <T> com.mongodb.DBRef createRef(T entity)
Deprecated.Description copied from interface:AdvancedDatastore
Creates a reference to the entity (using the current DB -can be null-, the collectionName, and id)- Specified by:
createRef
in interfaceAdvancedDatastore
- Type Parameters:
T
- The type of the entity- Parameters:
entity
- the entity to create a DBRef for- Returns:
- the DBRef for the entity
-
createUpdateOperations
public <T> UpdateOperations<T> createUpdateOperations(java.lang.Class<T> type, com.mongodb.DBObject ops)
Deprecated.Description copied from interface:AdvancedDatastore
Creates an UpdateOperations instance for the given type.- Specified by:
createUpdateOperations
in interfaceAdvancedDatastore
- Type Parameters:
T
- The type of the entity- Parameters:
type
- The type of the entityops
- The operations to perform- Returns:
- the UpdateOperations instance
-
delete
public <T,V> com.mongodb.WriteResult delete(java.lang.String kind, java.lang.Class<T> clazz, V id)
Deprecated.Description copied from interface:AdvancedDatastore
Deletes an entity of the given type T, with the givenid
, from the collection with the name in thekind
param. Validates theid
, checking it's the correct type for an ID for entities of typeT
. The entity typeclazz
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 givenid
, regardless of its type.- Specified by:
delete
in interfaceAdvancedDatastore
- Type Parameters:
T
- the entity typeV
- is the type of the ID, for example ObjectId- Parameters:
kind
- the collection nameclazz
- the Class of the entity to deleteid
- the value of the ID- Returns:
- the result of this delete operation.
-
delete
public <T,V> com.mongodb.WriteResult delete(java.lang.String kind, java.lang.Class<T> clazz, V id, DeleteOptions options)
Deprecated.Description copied from interface:AdvancedDatastore
Deletes an entity of the given type T, with the givenid
, from the collection with the name in thekind
param. Validates theid
, checking it's the correct type for an ID for entities of typeT
. The entity typeclazz
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 givenid
, regardless of its type.- Specified by:
delete
in interfaceAdvancedDatastore
- Type Parameters:
T
- the entity typeV
- is the type of the ID, for example ObjectId- Parameters:
kind
- the collection nameclazz
- the Class of the entity to deleteid
- the value of the IDoptions
- the options to use when deleting- Returns:
- the result of this delete operation.
-
delete
@Deprecated public <T,V> com.mongodb.WriteResult delete(java.lang.String kind, java.lang.Class<T> clazz, V id, com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:AdvancedDatastore
Deletes an entity of the given type T, with the givenid
, from the collection with the name in thekind
param. Validates theid
, checking it's the correct type for an ID for entities of typeT
. The entity typeclazz
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 givenid
, regardless of its type.- Specified by:
delete
in interfaceAdvancedDatastore
- Type Parameters:
T
- the entity typeV
- is the type of the ID, for example ObjectId- Parameters:
kind
- the collection nameclazz
- the Class of the entity to deleteid
- the value of the IDwc
- the WriteConcern for this operation- Returns:
- the result of this delete operation.
-
ensureIndex
@Deprecated public <T> void ensureIndex(java.lang.Class<T> type, java.lang.String fields)
Deprecated.Description copied from interface:Datastore
Ensures (creating if necessary) the index including the field(s) + directions on the given collection name; eg fields = "field1, -field2" ({field1:1, field2:-1})- Specified by:
ensureIndex
in interfaceDatastore
- Type Parameters:
T
- the type to index- Parameters:
type
- the class from which to get the index definitionsfields
- the fields to index- See Also:
MongoCollection.createIndex(org.bson.conversions.Bson, com.mongodb.client.model.IndexOptions)
-
ensureIndex
@Deprecated public <T> void ensureIndex(java.lang.Class<T> clazz, java.lang.String name, java.lang.String fields, boolean unique, boolean dropDupsOnCreate)
Deprecated.Description copied from interface:Datastore
Ensures (creating if necessary) the index including the field(s) + directions on the given collection name; eg fields = "field1, -field2" ({field1:1, field2:-1})- Specified by:
ensureIndex
in interfaceDatastore
- Type Parameters:
T
- the type to index- Parameters:
clazz
- the class from which to get the index definitionsname
- the name of the index to createfields
- the fields to indexunique
- true if the index should enforce uniqueness on the fields indexeddropDupsOnCreate
- Support for this has been removed from the server. This value is ignored.- See Also:
MongoCollection.createIndex(org.bson.conversions.Bson, com.mongodb.client.model.IndexOptions)
-
ensureIndexes
public void ensureIndexes()
Deprecated.Description copied from interface:Datastore
Ensures (creating if necessary) the indexes found during class mapping- Specified by:
ensureIndexes
in interfaceDatastore
- See Also:
Indexes
,Indexed
,Text
-
ensureIndexes
public void ensureIndexes(boolean background)
Deprecated.Description copied from interface:Datastore
Ensures (creating if necessary) the indexes found during class mapping (using@Indexed, @Indexes)
on the given collection name, possibly in the background- Specified by:
ensureIndexes
in interfaceDatastore
- Parameters:
background
- if true, the index will be built in the background. If false, background indexing is deferred to the annotation definition- See Also:
Indexes
,Indexed
,Text
-
ensureIndexes
public <T> void ensureIndexes(java.lang.Class<T> clazz)
Deprecated.Description copied from interface:Datastore
Ensures (creating if necessary) the indexes found during class mapping- Specified by:
ensureIndexes
in interfaceDatastore
- Type Parameters:
T
- the type to index- Parameters:
clazz
- the class from which to get the index definitions- See Also:
Indexes
,Indexed
,Text
-
ensureIndexes
public <T> void ensureIndexes(java.lang.Class<T> clazz, boolean background)
Deprecated.Description copied from interface:Datastore
Ensures (creating if necessary) the indexes found during class mapping- Specified by:
ensureIndexes
in interfaceDatastore
- Type Parameters:
T
- the type to index- Parameters:
clazz
- the class from which to get the index definitionsbackground
- if true, the index will be built in the background. If false, background indexing is deferred to the annotation definition- See Also:
Indexes
,Indexed
,Text
-
ensureIndex
@Deprecated public <T> void ensureIndex(java.lang.String collection, java.lang.Class<T> type, java.lang.String fields)
Deprecated.Description copied from interface:AdvancedDatastore
Ensures (creating if necessary) the index including the field(s) + directions on the given collection name; eg fields = "field1, -field2" ({field1:1, field2:-1})- Specified by:
ensureIndex
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type to index- Parameters:
collection
- the collection to updatetype
- the class from which to get the index definitionsfields
- the fields to index- See Also:
MongoCollection.createIndex(org.bson.conversions.Bson, com.mongodb.client.model.IndexOptions)
,AdvancedDatastore.ensureIndexes(String, Class)
-
ensureIndex
@Deprecated public <T> void ensureIndex(java.lang.String collection, java.lang.Class<T> clazz, java.lang.String name, java.lang.String fields, boolean unique, boolean dropDupsOnCreate)
Deprecated.Description copied from interface:AdvancedDatastore
Ensures (creating if necessary) the index including the field(s) + directions on the given collection name; eg fields = "field1, -field2" ({field1:1, field2:-1})- Specified by:
ensureIndex
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type to index- Parameters:
collection
- the collection to updateclazz
- the class from which to get the index definitionsname
- the name of the index to createfields
- the fields to indexunique
- true if the index should enforce uniqueness on the fields indexeddropDupsOnCreate
- This value is no longer supported. Tells the unique index to drop duplicates silently when creating; only the first will be kept- See Also:
MongoCollection.createIndex(org.bson.conversions.Bson, com.mongodb.client.model.IndexOptions)
,AdvancedDatastore.ensureIndexes(String, Class)
-
ensureIndexes
public <T> void ensureIndexes(java.lang.String collection, java.lang.Class<T> clazz)
Deprecated.Description copied from interface:AdvancedDatastore
Ensures (creating if necessary) the indexes found during class mapping (using@Indexed, @Indexes)
on the given collection name.- Specified by:
ensureIndexes
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type to index- Parameters:
collection
- the collection to updateclazz
- the class from which to get the index definitions
-
ensureIndexes
public <T> void ensureIndexes(java.lang.String collection, java.lang.Class<T> clazz, boolean background)
Deprecated.Description copied from interface:AdvancedDatastore
Ensures (creating if necessary) the indexes found during class mapping (using@Indexed, @Indexes)
on the given collection name, possibly in the background- Specified by:
ensureIndexes
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type to index- Parameters:
collection
- the collection to updateclazz
- the class from which to get the index definitionsbackground
- if true, the index will be built in the background. If false, the method will block until the index is created.
-
exists
public Key<?> exists(java.lang.Object entityOrKey, com.mongodb.ReadPreference readPreference)
Deprecated.Description copied from interface:AdvancedDatastore
Checks that an entity exists for the given key or entity- Specified by:
exists
in interfaceAdvancedDatastore
- Parameters:
entityOrKey
- the value to check forreadPreference
- Uses the supplied ReadPreference for the check. If readPreference is null the preference is taken from the annotation or uses the default preference.- Returns:
- the key if the entity exists
- See Also:
Datastore.exists(Object)
-
find
public <T> Query<T> find(java.lang.String collection, java.lang.Class<T> clazz)
Deprecated.Description copied from interface:AdvancedDatastore
Find all instances by type in a different collection than what is mapped on the class given.- Specified by:
find
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type to query- Parameters:
collection
- the collection to query againstclazz
- the class to use for mapping the results- Returns:
- the query
-
find
public <T,V> Query<T> find(java.lang.String collection, java.lang.Class<T> clazz, java.lang.String property, V value, int offset, int size)
Deprecated.Description copied from interface:AdvancedDatastore
Find all instances by type in a different collection than what is mapped on the class given skipping some documents and returning a fixed number of the remaining.- Specified by:
find
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type to queryV
- the type to filter value- Parameters:
collection
- the collection to query againstclazz
- the class to use for mapping the resultsproperty
- the document property to query againstvalue
- the value to check foroffset
- the number of results to skipsize
- the maximum number of results to return- Returns:
- the query
-
get
public <T> T get(java.lang.Class<T> clazz, com.mongodb.DBRef ref)
Deprecated.Description copied from interface:AdvancedDatastore
Find the given entity (by collectionName/id);- Specified by:
get
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type to fetch- Parameters:
clazz
- the class to use for mappingref
- the DBRef to use when querying- Returns:
- the entity referenced in the DBRef. May be null.
-
get
public <T,V> T get(java.lang.String collection, java.lang.Class<T> clazz, V id)
Deprecated.Description copied from interface:AdvancedDatastore
Finds an entity in the named collection whose id matches the value given.- Specified by:
get
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type to fetchV
- the type of the ID- Parameters:
collection
- the collection to queryclazz
- the class to use for mappingid
- the ID to query- Returns:
- the entity with the id. May be null.
-
getCount
public long getCount(java.lang.String collection)
Deprecated.Description copied from interface:AdvancedDatastore
Gets the count this collection- Specified by:
getCount
in interfaceAdvancedDatastore
- Parameters:
collection
- the collection to count- Returns:
- the collection size
-
getDecoderFact
public com.mongodb.DBDecoderFactory getDecoderFact()
Deprecated.Description copied from interface:AdvancedDatastore
Returns the DBDecoderFactory used by this Datastore- Specified by:
getDecoderFact
in interfaceAdvancedDatastore
- Returns:
- the decoder factory
- See Also:
DBDecoderFactory
-
setDecoderFact
public void setDecoderFact(com.mongodb.DBDecoderFactory fact)
Deprecated.Description copied from interface:AdvancedDatastore
Sets the DBDecoderFactory to use in this Datastore- Specified by:
setDecoderFact
in interfaceAdvancedDatastore
- Parameters:
fact
- the DBDecoderFactory to use
-
insert
public <T> Key<T> insert(java.lang.String collection, T entity)
Deprecated.Description copied from interface:AdvancedDatastore
Inserts an entity in to the named collection.- Specified by:
insert
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
collection
- the collection to updateentity
- the entity to insert- Returns:
- the new key of the inserted entity
-
insert
public <T> Key<T> insert(java.lang.String collection, T entity, InsertOptions options)
Deprecated.Description copied from interface:AdvancedDatastore
Inserts an entity in to the named collection.- Specified by:
insert
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
collection
- the collection to updateentity
- the entity to insertoptions
- the options to apply to the insert operation- Returns:
- the new key of the inserted entity
-
insert
public <T> Key<T> insert(T entity)
Deprecated.Description copied from interface:AdvancedDatastore
Inserts an entity in to the mapped collection. The return type will change in 2.0- Specified by:
insert
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
entity
- the entity to insert- Returns:
- the new key of the inserted entity
-
insert
public <T> Key<T> insert(T entity, com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:AdvancedDatastore
Inserts an entity in to the mapped collection.- Specified by:
insert
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
entity
- the entity to insertwc
- the WriteConcern to use when inserting- Returns:
- the new key of the inserted entity
- See Also:
WriteConcern
-
insert
public <T> Key<T> insert(T entity, InsertOptions options)
Deprecated.Description copied from interface:AdvancedDatastore
Inserts an entity in to the mapped collection. The return type will change in 2.0- Specified by:
insert
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
entity
- the entity to insertoptions
- the options to apply to the insert operation- Returns:
- the new key of the inserted entity
-
insert
@Deprecated public <T> java.lang.Iterable<Key<T>> insert(T... entities)
Deprecated.Description copied from interface:AdvancedDatastore
Inserts entities in to the mapped collection.- Specified by:
insert
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
entities
- the entities to insert- Returns:
- the new keys of the inserted entities
-
insert
public <T> java.lang.Iterable<Key<T>> insert(java.lang.Iterable<T> entities, com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:AdvancedDatastore
Inserts entities in to the mapped collection.- Specified by:
insert
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
entities
- the entities to insertwc
- the WriteConcern to use when inserting- Returns:
- the new keys of the inserted entities
-
insert
public <T> java.lang.Iterable<Key<T>> insert(java.lang.Iterable<T> entities, InsertOptions options)
Deprecated.Description copied from interface:AdvancedDatastore
Inserts entities in to the mapped collection. The return type will change in 2.0- Specified by:
insert
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
entities
- the entities to insertoptions
- the options to apply to the insert operation- Returns:
- the new keys of the inserted entities
-
insert
public <T> java.util.List<Key<T>> insert(java.util.List<T> entities, InsertOptions options)
Deprecated.Description copied from interface:AdvancedDatastore
Inserts entities in to the mapped collection. The return type will change in 2.0- Specified by:
insert
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
entities
- the entities to insertoptions
- the options to apply to the insert operation- Returns:
- the new keys of the inserted entities
-
insert
public <T> java.lang.Iterable<Key<T>> insert(java.lang.String collection, java.lang.Iterable<T> entities)
Deprecated.Description copied from interface:AdvancedDatastore
Inserts an entity in to the named collection.- Specified by:
insert
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
collection
- the collection to updateentities
- the entities to insert- Returns:
- the new keys of the inserted entities
-
insert
public <T> java.lang.Iterable<Key<T>> insert(java.lang.String collection, java.lang.Iterable<T> entities, com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:AdvancedDatastore
Inserts an entity in to the named collection.- Specified by:
insert
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
collection
- the collection to updateentities
- the entities to insertwc
- the WriteConcern to use when inserting- Returns:
- the new keys of the inserted entities
- See Also:
WriteConcern
-
insert
public <T> java.lang.Iterable<Key<T>> insert(java.lang.String collection, java.lang.Iterable<T> entities, InsertOptions options)
Deprecated.Description copied from interface:AdvancedDatastore
Inserts entities in to the named collection.- Specified by:
insert
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
collection
- the collection to updateentities
- the entities to insertoptions
- the options to apply to the insert operation- Returns:
- the new keys of the inserted entities
-
queryByExample
public <T> Query<T> queryByExample(java.lang.String collection, T ex)
Deprecated.Description copied from interface:AdvancedDatastore
Returns a new query based on the example object- Specified by:
queryByExample
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
collection
- the collection to queryex
- the example entity to use when building the query- Returns:
- the query
-
save
public <T> Key<T> save(java.lang.String collection, T entity)
Deprecated.Description copied from interface:AdvancedDatastore
Saves an entity in to the named collection.- Specified by:
save
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
collection
- the collection to updateentity
- the entity to save- Returns:
- the new key of the inserted entity
-
save
public <T> Key<T> save(java.lang.String collection, T entity, com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:AdvancedDatastore
Saves an entity in to the named collection.- Specified by:
save
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
collection
- the collection to updateentity
- the entity to savewc
- the WriteConcern to use when inserting- Returns:
- the new key of the inserted entity
-
save
public <T> Key<T> save(java.lang.String collection, T entity, InsertOptions options)
Deprecated.Description copied from interface:AdvancedDatastore
Saves an entity in to the named collection.- Specified by:
save
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entity- Parameters:
collection
- the collection to updateentity
- the entity to saveoptions
- the options to apply to the save operation- Returns:
- the new key of the inserted entity
-
find
public <T,V> Query<T> find(java.lang.String collection, java.lang.Class<T> clazz, java.lang.String property, V value, int offset, int size, boolean validate)
Deprecated.Find all instances by type in a different collection than what is mapped on the class given skipping some documents and returning a fixed number of the remaining.- Type Parameters:
T
- the type to queryV
- the type to filter value- Parameters:
collection
- The collection use when queryingclazz
- the class to use for mapping the resultsproperty
- the document property to query againstvalue
- the value to check foroffset
- the number of results to skipsize
- the maximum number of results to returnvalidate
- if true, validate the query- Returns:
- the query
-
getMapper
public Mapper getMapper()
Deprecated.
-
setMapper
public void setMapper(Mapper mapper)
Deprecated.Sets the Mapper this Datastore uses- Parameters:
mapper
- the new Mapper
-
insert
public <T> java.lang.Iterable<Key<T>> insert(java.lang.Iterable<T> entities)
Deprecated.Inserts entities in to the database- Specified by:
insert
in interfaceAdvancedDatastore
- Type Parameters:
T
- the type of the entities- Parameters:
entities
- the entities to insert- Returns:
- the keys of entities
-
save
public <T> java.lang.Iterable<Key<T>> save(java.lang.Iterable<T> entities)
Deprecated.Description copied from interface:Datastore
Saves the entities (Objects) and updates the @Id field The return type will change in 2.0
-
insert
public <T> Key<T> insert(java.lang.String collection, T entity, com.mongodb.WriteConcern wc)
Deprecated.Inserts an entity in to the database- Type Parameters:
T
- the type of the entities- Parameters:
collection
- the collection to query againstentity
- the entity to insertwc
- the WriteConcern to use when deleting- Returns:
- the key of entity
-
getId
@Deprecated protected java.lang.Object getId(java.lang.Object entity)
Deprecated.
-
insert
protected <T> Key<T> insert(com.mongodb.DBCollection dbColl, T entity, InsertOptions options)
Deprecated.
-
save
protected <T> Key<T> save(com.mongodb.DBCollection dbColl, T entity, InsertOptions options)
Deprecated.
-
update
public <T> UpdateResults update(Query<T> query, UpdateOperations<T> operations, UpdateOptions options)
Deprecated.Description copied from interface:Datastore
Updates all entities found with the operations; this is an atomic operation per entity
-
-