Package dev.morphia

Class 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 collections
    Developer 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)
      AggregationPipeline createAggregation​(java.lang.Class source)
      Deprecated.
      Returns a new query bound to the kind (a specific DBCollection)
      AggregationPipeline createAggregation​(java.lang.String collection, java.lang.Class<?> clazz)
      Deprecated.
      Returns an AggregationPipeline 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 specific DBCollection)
      <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.DBRef
      createRef​(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.WriteResult
      delete​(java.lang.Class<T> clazz, java.lang.Iterable<V> ids)
      Deprecated.
      Deletes the given entities (by id)
      <T,​V>
      com.mongodb.WriteResult
      delete​(java.lang.Class<T> clazz, java.lang.Iterable<V> ids, DeleteOptions options)
      Deprecated.
      Deletes the given entities (by id)
      <T,​V>
      com.mongodb.WriteResult
      delete​(java.lang.Class<T> clazz, V id)
      Deprecated.
      Deletes the given entity (by id)
      <T,​V>
      com.mongodb.WriteResult
      delete​(java.lang.Class<T> clazz, V id, DeleteOptions options)
      Deprecated.
      Deletes the given entity (by id)
      <T,​V>
      com.mongodb.WriteResult
      delete​(java.lang.String kind, java.lang.Class<T> clazz, V id)
      Deprecated.
      Deletes an entity of the given type T, with the given id, from the collection with the name in the kind param.
      <T,​V>
      com.mongodb.WriteResult
      delete​(java.lang.String kind, java.lang.Class<T> clazz, V id, com.mongodb.WriteConcern wc)
      Deprecated.
      <T,​V>
      com.mongodb.WriteResult
      delete​(java.lang.String kind, java.lang.Class<T> clazz, V id, DeleteOptions options)
      Deprecated.
      Deletes an entity of the given type T, with the given id, from the collection with the name in the kind 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 WriteConcern
      void enableDocumentValidation()
      Deprecated.
      Process any Validation annotations for document validation.
      void ensureCaps()
      Deprecated.
      ensure capped collections for Entity(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 mapping
      void 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 background
      Key<?> exists​(java.lang.Object entityOrKey)
      Deprecated.
      Does a query to check if the keyOrEntity exists in mongodb
      Key<?> 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 for find("_id in", ids)
      <T,​V>
      T
      get​(java.lang.Class<T> clazz, V id)
      Deprecated.
      Find the given entity (by id); shorthand for find("_id ", id)
      <T,​V>
      T
      get​(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 for find("_id in", ids)
      <T> java.util.List<T> getByKeys​(java.lang.Iterable<Key<T>> keys)
      Deprecated.
      Find the given entities (by id); shorthand for find("_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 as query.countAll()
      <T> long getCount​(Query<T> query, CountOptions options)
      Deprecated.
      Gets the count of items returned by this query; same as query.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 Datastore
      com.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 object
      protected <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.0
      void setDecoderFact​(com.mongodb.DBDecoderFactory fact)
      Deprecated.
      Sets the DBDecoderFactory to use in this Datastore
      void setDefaultWriteConcern​(com.mongodb.WriteConcern wc)
      Deprecated.
      Sets the default WriteConcern for this Datastore
      void setMapper​(Mapper mapper)
      Deprecated.
      Sets the Mapper this Datastore uses
      void setQueryFactory​(QueryFactory queryFactory)
      Deprecated.
      Replaces the current QueryFactory 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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. Use Morphia.createDatastore(MongoClient, Mapper, String)
        Create a new DatastoreImpl
        Parameters:
        morphia - the Morphia instance
        mongoClient - the connection to the MongoDB instance
        dbName - 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. Use Morphia.createDatastore(MongoClient, Mapper, String)
        Create a new DatastoreImpl
        Parameters:
        morphia - the Morphia instance
        mapper - an initialised Mapper
        mongoClient - the connection to the MongoDB instance
        dbName - the name of the database for this data store.
    • Method Detail

      • copy

        @Deprecated
        public DatastoreImpl copy​(java.lang.String database)
        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 specific DBCollection)
        Specified by:
        createAggregation in interface Datastore
        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 an AggregationPipeline bound to the given collection and class.
        Specified by:
        createAggregation in interface AdvancedDatastore
        Parameters:
        collection - the collection to query
        clazz - 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 specific DBCollection)
        Specified by:
        createQuery in interface Datastore
        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 interface Datastore
        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
        Specified by:
        delete in interface Datastore
        Type Parameters:
        T - the type to delete
        Parameters:
        query - the query to use when finding documents to delete
        options - the options to apply to the delete
        Returns:
        results of the delete
      • 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)
        Specified by:
        delete in interface Datastore
        Type Parameters:
        T - the type to delete
        V - the type of the id
        Parameters:
        clazz - the type to delete
        id - the ID of the entity to delete
        Returns:
        results of the delete
      • 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)
        Specified by:
        delete in interface Datastore
        Type Parameters:
        T - the type to delete
        V - the type of the id
        Parameters:
        clazz - the type to delete
        id - the ID of the entity to delete
        options - the options to use when deleting
        Returns:
        results of the delete
      • 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)
        Specified by:
        delete in interface Datastore
        Type Parameters:
        T - the type to delete
        V - the type of the id
        Parameters:
        clazz - the type to delete
        ids - the IDs of the entity to delete
        Returns:
        results of the delete
      • 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)
        Specified by:
        delete in interface Datastore
        Type Parameters:
        T - the type to delete
        V - the type of the id
        Parameters:
        clazz - the type to delete
        ids - the IDs of the entity to delete
        options - the options to use when deleting
        Returns:
        results of the delete
      • delete

        public <T> com.mongodb.WriteResult delete​(Query<T> query)
        Deprecated.
        Description copied from interface: Datastore
        Deletes entities based on the query
        Specified by:
        delete in interface Datastore
        Type Parameters:
        T - the type to delete
        Parameters:
        query - the query to use when finding documents to delete
        Returns:
        results of the delete
      • 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
        Specified by:
        delete in interface Datastore
        Type Parameters:
        T - the type to delete
        Parameters:
        query - the query to use when finding documents to delete
        wc - the WriteConcern to use when deleting
        Returns:
        results of the delete
      • delete

        public <T> com.mongodb.WriteResult delete​(T entity)
        Deprecated.
        Description copied from interface: Datastore
        Deletes the given entity (by @Id)
        Specified by:
        delete in interface Datastore
        Type Parameters:
        T - the type to delete
        Parameters:
        entity - the entity to delete
        Returns:
        results of the delete
      • 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
        Specified by:
        delete in interface Datastore
        Type Parameters:
        T - the type to delete
        Parameters:
        entity - the entity to delete
        wc - the WriteConcern to use when deleting
        Returns:
        results of the delete
      • delete

        public <T> com.mongodb.WriteResult delete​(T entity,
                                                  DeleteOptions options)
        Deprecated.
        Deletes the given entity (by @Id), with the WriteConcern
        Specified by:
        delete in interface Datastore
        Type Parameters:
        T - the type to delete
        Parameters:
        entity - the entity to delete
        options - the options to use when deleting
        Returns:
        results of the delete
      • ensureCaps

        public void ensureCaps()
        Deprecated.
        Description copied from interface: Datastore
        ensure capped collections for Entity(s)
        Specified by:
        ensureCaps in interface Datastore
      • 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
        Specified by:
        exists in interface Datastore
        Parameters:
        entityOrKey - the value to check for
        Returns:
        the key if the entity exists
      • find

        public <T> Query<T> find​(java.lang.Class<T> clazz)
        Deprecated.
        Description copied from interface: Datastore
        Find all instances by type
        Specified by:
        find in interface Datastore
        Type Parameters:
        T - the type to query
        Parameters:
        clazz - the class to use for mapping the results
        Returns:
        the query
      • 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);

        Specified by:
        find in interface Datastore
        Type Parameters:
        T - the type to query
        V - the type to filter value
        Parameters:
        clazz - the class to use for mapping the results
        property - the document property to query against
        value - the value to check for
        Returns:
        the query
      • 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 interface Datastore
        Type Parameters:
        T - the type to query
        V - the type to filter value
        Parameters:
        clazz - the class to use for mapping the results
        property - the document property to query against
        value - the value to check for
        offset - the number of results to skip
        size - 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 interface Datastore
        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 interface Datastore
        Type Parameters:
        T - the type to query
        Parameters:
        query - the query to use when finding entities to delete
        options - 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 interface Datastore
        Type Parameters:
        T - the type to query
        Parameters:
        query - the query to use when finding entities to update
        operations - the updates to apply to the matched documents
        options - 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 interface Datastore
        Type Parameters:
        T - the type to query
        Parameters:
        query - the query to use when finding entities to update
        operations - 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 interface Datastore
        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 documents
        oldVersion - 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 interface Datastore
        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 documents
        oldVersion - indicated the old version of the Entity should be returned
        createIfMissing - 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 for find("_id in", ids)
        Specified by:
        get in interface Datastore
        Type Parameters:
        T - the type to fetch
        V - the type of the ID
        Parameters:
        clazz - the class to use for mapping
        ids - the IDs to query
        Returns:
        the query to find the entities
      • 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 for find("_id ", id)
        Specified by:
        get in interface Datastore
        Type Parameters:
        T - the type to fetch
        V - the type of the ID
        Parameters:
        clazz - the class to use for mapping
        id - the ID to query
        Returns:
        the matched entity. may be null.
      • 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
        Specified by:
        get in interface Datastore
        Type Parameters:
        T - the type to fetch
        Parameters:
        entity - The entity to search for
        Returns:
        the matched entity. may be null.
      • 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);
        Specified by:
        getByKey in interface Datastore
        Type Parameters:
        T - the type to fetch
        Parameters:
        clazz - the class to use for mapping
        key - the key search with
        Returns:
        the matched entity. may be null.
      • 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 for find("_id in", ids)
        Specified by:
        getByKeys in interface Datastore
        Type Parameters:
        T - the type to fetch
        Parameters:
        clazz - the class to use for mapping
        keys - the keys to search with
        Returns:
        the matched entities. may be null.
      • 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 for find("_id in", ids)
        Specified by:
        getByKeys in interface Datastore
        Type Parameters:
        T - the type to fetch
        Parameters:
        keys - the keys to search with
        Returns:
        the matched entities. may be null.
      • 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 interface Datastore
        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)
        Specified by:
        getCount in interface Datastore
        Type Parameters:
        T - the type to count
        Parameters:
        entity - The entity whose type to count
        Returns:
        the count
      • getCount

        public <T> long getCount​(java.lang.Class<T> clazz)
        Deprecated.
        Description copied from interface: Datastore
        Gets the count this kind (DBCollection)
        Specified by:
        getCount in interface Datastore
        Type Parameters:
        T - the type to count
        Parameters:
        clazz - The clazz type to count
        Returns:
        the count
      • getCount

        public <T> long getCount​(Query<T> query)
        Deprecated.
        Description copied from interface: Datastore
        Gets the count of items returned by this query; same as query.countAll()
        Specified by:
        getCount in interface Datastore
        Type Parameters:
        T - the type to count
        Parameters:
        query - the query to filter the documents to count
        Returns:
        the count
      • 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 as query.countAll()
        Specified by:
        getCount in interface Datastore
        Type Parameters:
        T - the type to count
        Parameters:
        query - the query to filter the documents to count
        options - the options to apply to the count
        Returns:
        the count
      • getDB

        public com.mongodb.DB getDB()
        Deprecated.
        Specified by:
        getDB in interface Datastore
        Returns:
        the DB this Datastore uses
        See Also:
        MongoClient.getDB(String), MongoDatabase
      • getDatabase

        public com.mongodb.client.MongoDatabase getDatabase()
        Deprecated.
        Specified by:
        getDatabase in interface Datastore
        Returns:
        the MongoDatabase used by this DataStore
      • getDefaultWriteConcern

        public com.mongodb.WriteConcern getDefaultWriteConcern()
        Deprecated.
        Specified by:
        getDefaultWriteConcern in interface Datastore
        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 interface Datastore
        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 a DBRef
        Specified by:
        getKey in interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entity - the entity whose key is to be returned
        Returns:
        the Key
      • 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.
        Specified by:
        getMongo in interface Datastore
        Returns:
        the MongoClient being used by this datastore.
      • mapReduce

        public <T> MapreduceResults<T> mapReduce​(MapReduceOptions<T> options)
        Deprecated.
        Description copied from interface: Datastore
        Runs a map/reduce job at the server
        Specified by:
        mapReduce in interface Datastore
        Type Parameters:
        T - The type of resulting data
        Parameters:
        options - the options to apply to the map/reduce job
        Returns:
        the results
      • 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 interface Datastore
        Type Parameters:
        T - The type of resulting data
        Parameters:
        type - MapreduceType
        query - The query (only the criteria, limit and sort will be used)
        map - The map function, in javascript, as a string
        reduce - The reduce function, in javascript, as a string
        finalize - The finalize function, in javascript, as a string; can be null
        scopeFields - Each map entry will be a global variable in all the functions; can be null
        outputType - 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 interface Datastore
        Type Parameters:
        T - The type of resulting data
        Parameters:
        type - MapreduceType
        query - The query (only the criteria, limit and sort will be used)
        outputType - The type of resulting data; inline is not working yet
        baseCommand - 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.
        Specified by:
        merge in interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entity - the entity to merge back in to the database
        Returns:
        the key 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.
        Specified by:
        merge in interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entity - the entity to merge back in to the database
        wc - the WriteConcern to use
        Returns:
        the key 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 interface Datastore
        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 interface AdvancedDatastore
        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
        Specified by:
        save in interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entities - the entities to save
        wc - the WriteConcern to use
        Returns:
        the keys of the entities
      • 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
        Specified by:
        save in interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entities - the entities to save
        options - the options to apply to the save operation
        Returns:
        the keys of the entities
      • 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
        Specified by:
        save in interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entities - the entities to save
        Returns:
        the keys of the entities
      • 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
        Specified by:
        save in interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entity - the entity to save
        Returns:
        the keys of the entity
      • 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
        Specified by:
        save in interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entity - the entity to save
        wc - the WriteConcern to use
        Returns:
        the keys of the entity
      • 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
        Specified by:
        save in interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entity - the entity to save
        options - the options to apply to the save operation
        Returns:
        the keys of the entity
      • 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 interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entity - the entity to update
        operations - 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 interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        key - the key of entity to update
        operations - 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
        Specified by:
        update in interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        query - the query used to match the documents to update
        operations - the update operations to perform
        Returns:
        the results of the updates
      • 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 interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        query - the query used to match the documents to update
        operations - the update operations to perform
        createIfMissing - 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 interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        query - the query used to match the documents to update
        operations - the update operations to perform
        createIfMissing - if true, a document will be created if none can be found that match the query
        wc - 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 interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        query - the query used to match the document to update
        operations - 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 interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        query - the query used to match the documents to update
        operations - the update operations to perform
        createIfMissing - 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 interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        query - the query used to match the documents to update
        operations - the update operations to perform
        createIfMissing - if true, a document will be created if none can be found that match the query
        wc - 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 interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        query - the query used to match the documents to update
        entity - the entity whose state will be used as an update template for any matching documents
        createIfMissing - 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 interface AdvancedDatastore
        Type Parameters:
        T - The type of the entity
        Parameters:
        collection - the collection to query
        type - 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 interface AdvancedDatastore
        Type Parameters:
        T - The type of the entity
        Parameters:
        clazz - the class of objects to be returned
        q - the query which will be passed to a QueryFactory
        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 interface AdvancedDatastore
        Type Parameters:
        T - The type of the entity
        Parameters:
        collection - the collection to query
        type - the class of objects to be returned
        q - the query which will be passed to a QueryFactory
        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 interface AdvancedDatastore
        Type Parameters:
        T - The type of the entity
        V - The type of the ID value
        Parameters:
        clazz - The type of the entity
        id - 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 interface AdvancedDatastore
        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 interface AdvancedDatastore
        Type Parameters:
        T - The type of the entity
        Parameters:
        type - The type of the entity
        ops - 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 given 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.
        Specified by:
        delete in interface AdvancedDatastore
        Type Parameters:
        T - the entity type
        V - is the type of the ID, for example ObjectId
        Parameters:
        kind - the collection name
        clazz - the Class of the entity to delete
        id - 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 given 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.
        Specified by:
        delete in interface AdvancedDatastore
        Type Parameters:
        T - the entity type
        V - is the type of the ID, for example ObjectId
        Parameters:
        kind - the collection name
        clazz - the Class of the entity to delete
        id - the value of the ID
        options - 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 given 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.
        Specified by:
        delete in interface AdvancedDatastore
        Type Parameters:
        T - the entity type
        V - is the type of the ID, for example ObjectId
        Parameters:
        kind - the collection name
        clazz - the Class of the entity to delete
        id - the value of the ID
        wc - 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 interface Datastore
        Type Parameters:
        T - the type to index
        Parameters:
        type - the class from which to get the index definitions
        fields - 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 interface Datastore
        Type Parameters:
        T - the type to index
        Parameters:
        clazz - the class from which to get the index definitions
        name - the name of the index to create
        fields - the fields to index
        unique - true if the index should enforce uniqueness on the fields indexed
        dropDupsOnCreate - 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 interface Datastore
        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 interface Datastore
        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 interface Datastore
        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 interface Datastore
        Type Parameters:
        T - the type to index
        Parameters:
        clazz - the class from which to get the index definitions
        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
      • 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 interface AdvancedDatastore
        Type Parameters:
        T - the type to index
        Parameters:
        collection - the collection to update
        type - the class from which to get the index definitions
        fields - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type to index
        Parameters:
        collection - the collection to update
        clazz - the class from which to get the index definitions
        name - the name of the index to create
        fields - the fields to index
        unique - true if the index should enforce uniqueness on the fields indexed
        dropDupsOnCreate - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type to index
        Parameters:
        collection - the collection to update
        clazz - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type to index
        Parameters:
        collection - the collection to update
        clazz - the class from which to get the index definitions
        background - 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 interface AdvancedDatastore
        Parameters:
        entityOrKey - the value to check for
        readPreference - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type to query
        Parameters:
        collection - the collection to query against
        clazz - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type to query
        V - the type to filter value
        Parameters:
        collection - the collection to query against
        clazz - the class to use for mapping the results
        property - the document property to query against
        value - the value to check for
        offset - the number of results to skip
        size - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type to fetch
        Parameters:
        clazz - the class to use for mapping
        ref - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type to fetch
        V - the type of the ID
        Parameters:
        collection - the collection to query
        clazz - the class to use for mapping
        id - 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 interface AdvancedDatastore
        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 interface AdvancedDatastore
        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 interface AdvancedDatastore
        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 interface AdvancedDatastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        collection - the collection to update
        entity - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        collection - the collection to update
        entity - the entity to insert
        options - 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 interface AdvancedDatastore
        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 interface AdvancedDatastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entity - the entity to insert
        wc - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entity - the entity to insert
        options - 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 interface AdvancedDatastore
        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 interface AdvancedDatastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entities - the entities to insert
        wc - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entities - the entities to insert
        options - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entities - the entities to insert
        options - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        collection - the collection to update
        entities - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        collection - the collection to update
        entities - the entities to insert
        wc - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        collection - the collection to update
        entities - the entities to insert
        options - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        collection - the collection to query
        ex - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        collection - the collection to update
        entity - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        collection - the collection to update
        entity - the entity to save
        wc - 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 interface AdvancedDatastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        collection - the collection to update
        entity - the entity to save
        options - 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 query
        V - the type to filter value
        Parameters:
        collection - The collection use when querying
        clazz - the class to use for mapping the results
        property - the document property to query against
        value - the value to check for
        offset - the number of results to skip
        size - the maximum number of results to return
        validate - if true, validate the query
        Returns:
        the query
      • getMapper

        public Mapper getMapper()
        Deprecated.
        Specified by:
        getMapper in interface Datastore
        Returns:
        the Mapper used by this Datastore
      • 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 interface AdvancedDatastore
        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
        Specified by:
        save in interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        entities - the entities to save
        Returns:
        the keys of the entities
      • 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 against
        entity - the entity to insert
        wc - 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
        Specified by:
        update in interface Datastore
        Type Parameters:
        T - the type of the entity
        Parameters:
        query - the query used to match the documents to update
        operations - the update operations to perform
        options - the options to apply to the update
        Returns:
        the results of the updates