Package dev.morphia

Interface AdvancedDatastore

  • All Superinterfaces:
    Datastore
    All Known Subinterfaces:
    MorphiaSession
    All Known Implementing Classes:
    DatastoreImpl, MorphiaSessionImpl

    @Deprecated(since="2.0",
                forRemoval=true)
    public interface AdvancedDatastore
    extends Datastore
    Deprecated, for removal: This API element is subject to removal in a future version.
    This interface exposes advanced Datastore features, like interacting with Document and low-level options. It implements matching methods from the Datastore interface but with a specified kind (collection name), or raw types (Document).
    • Method Detail

      • createAggregation

        @Deprecated(since="2.0",
                    forRemoval=true)
        AggregationPipeline createAggregation​(String collection,
                                              Class<?> clazz)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns an AggregationPipeline bound to the given collection and class.
        Parameters:
        collection - the collection to query
        clazz - The class to create aggregation against
        Returns:
        the aggregation pipeline
      • createQuery

        @Deprecated(since="2.0",
                    forRemoval=true)
        <T> Query<T> createQuery​(Class<T> type,
                                 org.bson.Document q)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Type Parameters:
        T - The type of the entity
        Parameters:
        type - the class of objects to be returned
        q - the query which will be passed to a QueryFactory
        Returns:
        Query for the specified class type
      • createRef

        @Deprecated(since="2.0",
                    forRemoval=true)
        default <T,​V> com.mongodb.DBRef createRef​(Class<T> clazz,
                                                        V id)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Creates a reference to the entity (using the current DB -can be null-, the collectionName, and id)
        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

        @Deprecated(since="2.0",
                    forRemoval=true)
        default <T> com.mongodb.DBRef createRef​(T entity)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Creates a reference to the entity (using the current DB -can be null-, the collectionName, and id)
        Type Parameters:
        T - The type of the entity
        Parameters:
        entity - the entity to create a DBRef for
        Returns:
        the DBRef for the entity
      • createUpdateOperations

        @Deprecated(since="2.0",
                    forRemoval=true)
        default <T> UpdateOperations<T> createUpdateOperations​(Class<T> type,
                                                               com.mongodb.DBObject ops)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Creates an UpdateOperations instance for the given type.
        Type Parameters:
        T - The type of the entity
        Parameters:
        type - The type of the entity
        ops - The operations to perform
        Returns:
        the UpdateOperations instance
      • insert

        @Deprecated(since="2.0",
                    forRemoval=true)
        default <T> void insert​(T entity,
                                InsertOptions options)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Inserts an entity in to the mapped collection.
        Type Parameters:
        T - the type of the entity
        Parameters:
        entity - the entity to insert
        options - the options to apply to the insert operation
        Since:
        1.3
        Developer note. Inline this method to update to the new usage
      • insert

        @Deprecated(since="2.0",
                    forRemoval=true)
        default <T> void insert​(List<T> entities,
                                InsertOptions options)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Inserts entities in to the mapped collection.
        Type Parameters:
        T - the type of the entity
        Parameters:
        entities - the entities to insert
        options - the options to apply to the insert operation
        Since:
        1.3
        Developer note. Inline this method to update to the new usage
      • queryByExample

        @Deprecated(since="2.0",
                    forRemoval=true)
        <T> Query<T> queryByExample​(String collection,
                                    T example)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns a new query based on the example object
        Type Parameters:
        T - the type of the entity
        Parameters:
        collection - the collection to query
        example - the example entity to use when building the query
        Returns:
        the query