Class MongoDBRepository

java.lang.Object
org.nuxeo.ecm.core.storage.dbs.DBSRepositoryBase
org.nuxeo.ecm.core.storage.mongodb.MongoDBRepository
All Implemented Interfaces:
LockManager, Repository, DBSRepository

public class MongoDBRepository extends DBSRepositoryBase
MongoDB implementation of a Repository.
Since:
5.9.4
  • Field Details

    • REPOSITORY_CONNECTION_PREFIX

      public static final String REPOSITORY_CONNECTION_PREFIX
      Prefix used to retrieve a MongoDB connection from MongoDBConnectionService.

      The connection id will be repository/[REPOSITORY_NAME].

      See Also:
    • LONG_ZERO

      public static final Long LONG_ZERO
    • ZERO

      public static final Double ZERO
    • ONE

      public static final Double ONE
    • MONGODB_ID

      public static final String MONGODB_ID
      See Also:
    • MONGODB_INC

      public static final String MONGODB_INC
      See Also:
    • MONGODB_SET

      public static final String MONGODB_SET
      See Also:
    • MONGODB_UNSET

      public static final String MONGODB_UNSET
      See Also:
    • MONGODB_PUSH

      public static final String MONGODB_PUSH
      See Also:
    • MONGODB_PULLALL

      public static final String MONGODB_PULLALL
      Since:
      11.5
      See Also:
    • MONGODB_EACH

      public static final String MONGODB_EACH
      See Also:
    • MONGODB_META

      public static final String MONGODB_META
      See Also:
    • MONGODB_TYPE

      public static final String MONGODB_TYPE
      See Also:
    • MONGODB_TEXT_SCORE

      public static final String MONGODB_TEXT_SCORE
      See Also:
    • FULLTEXT_INDEX_NAME

      public static final String FULLTEXT_INDEX_NAME
      See Also:
    • LANGUAGE_FIELD

      public static final String LANGUAGE_FIELD
      See Also:
    • SEQUENCE_RANDOMIZED_BLOCKSIZE_DEFAULT

      protected static final int SEQUENCE_RANDOMIZED_BLOCKSIZE_DEFAULT
      See Also:
    • COUNTER_NAME_UUID

      public static final String COUNTER_NAME_UUID
      See Also:
    • COUNTER_FIELD

      public static final String COUNTER_FIELD
      See Also:
    • MAX_TIME_DEFAULT

      protected static final Duration MAX_TIME_DEFAULT
      Default maximum execution time for a query.
      Since:
      11.1
    • SETTING_VALUE

      protected static final String SETTING_VALUE
      See Also:
    • SETTING_DENORMALIZED_BLOB_KEYS

      protected static final String SETTING_DENORMALIZED_BLOB_KEYS
      Settings key to determine whether ecm:blobKeys is supported.

      The value is true on new or migrated repositories.

      See Also:
    • GC_NO_CURSOR_TIMEOUT

      protected static final String GC_NO_CURSOR_TIMEOUT
      Since:
      2021.14
      See Also:
    • idKey

      protected String idKey
      The key to use to store the id in the database.
    • sequenceBlockSize

      protected long sequenceBlockSize
      Sequence allocation block size.
    • descriptor

      protected final MongoDBRepositoryDescriptor descriptor
    • mongoClient

      protected final com.mongodb.client.MongoClient mongoClient
    • converter

      protected final MongoDBConverter converter
    • cursorService

      protected final MongoDBCursorService cursorService
    • coll

      protected final com.mongodb.client.MongoCollection<org.bson.Document> coll
    • countersColl

      protected final com.mongodb.client.MongoCollection<org.bson.Document> countersColl
    • settingsColl

      protected final com.mongodb.client.MongoCollection<org.bson.Document> settingsColl
    • supportsSessions

      protected final boolean supportsSessions
    • supportsTransactions

      protected final boolean supportsTransactions
    • maxTimeMS

      protected final long maxTimeMS
      Maximum execution time for a query when outside of a transaction.
      Since:
      11.1
    • supportsDenormalizedBlobKeys

      protected boolean supportsDenormalizedBlobKeys
    • indexInitialized

      protected volatile boolean indexInitialized
    • binaryKeys

      protected org.bson.conversions.Bson binaryKeys
      Keys used for document projection when marking all binaries for GC.

      Used when denormalized ecm:blobKeys is not available.

  • Constructor Details

  • Method Details

    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface Repository
      Overrides:
      shutdown in class DBSRepositoryBase
    • initRepository

      protected void initRepository()
    • initSettings

      protected void initSettings()
    • updateCapabilities

      public void updateCapabilities()
      Description copied from interface: DBSRepository
      Update repository capabilities after a migration. Internal use only.
    • readSettings

      protected void readSettings()
    • initCapabilities

      protected void initCapabilities()
    • getConnection

      public MongoDBConnection getConnection()
      Description copied from interface: DBSRepository
      Gets a new connection to this repository.
      Returns:
      a new connection
    • getAllowedIdTypes

      public List<DBSRepositoryBase.IdType> getAllowedIdTypes()
      Description copied from class: DBSRepositoryBase
      Gets the allowed id types for this DBS repository. The first one is the default.
      Specified by:
      getAllowedIdTypes in class DBSRepositoryBase
    • supportsSessions

      protected boolean supportsSessions()
    • supportsTransactions

      public boolean supportsTransactions()
      Description copied from interface: DBSRepository
      Checks whether this repository supports transactions.
      Returns:
      true if the repository supports transactions
      See Also:
    • getClient

      protected com.mongodb.client.MongoClient getClient()
    • getCursorService

      protected MongoDBCursorService getCursorService()
    • getCollection

      protected com.mongodb.client.MongoCollection<org.bson.Document> getCollection()
    • getCountersCollection

      protected com.mongodb.client.MongoCollection<org.bson.Document> getCountersCollection()
    • getIdKey

      protected String getIdKey()
    • getConverter

      protected MongoDBConverter getConverter()
    • initBlobsPaths

      protected void initBlobsPaths()
      Overrides:
      initBlobsPaths in class DBSRepositoryBase
    • markReferencedBlobs

      public void markReferencedBlobs(BiConsumer<String,String> markerCallback)
      Description copied from interface: Repository
      Marks the blobs in use by passing them to the provided callback (taking the blob key and the repository name).
    • markReferencedBlobsDenormalized

      protected void markReferencedBlobsDenormalized(org.bson.Document ob, BiConsumer<String,String> markReferencedBlob)
    • markReferencedBlobs

      protected void markReferencedBlobs(org.bson.Document ob, BiConsumer<String,String> markerCallback)
    • markReferencedBlob

      protected void markReferencedBlob(Object value, BiConsumer<String,String> markerCallback)