Class MongoDBDirectory

    • Field Detail

      • DIRECTORY_CONNECTION_PREFIX

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

        The connection id will be directory/[DIRECTORY_NAME].

        Since:
        10.10
        See Also:
        Constant Field Values
      • database

        protected com.mongodb.client.MongoDatabase database
      • collection

        protected com.mongodb.client.MongoCollection<org.bson.Document> collection
      • countersCollection

        protected com.mongodb.client.MongoCollection<org.bson.Document> countersCollection
    • Method Detail

      • getSession

        public MongoDBSession getSession()
        Description copied from interface: Directory
        Creates a session for accessing entries in this directory.
        Returns:
        a Session object
      • initialize

        public void initialize()
        Description copied from interface: Directory
        INTERNAL, DO NOT CALL. Initializes the directory when Nuxeo starts. Called without a transaction.
        Specified by:
        initialize in interface Directory
        Overrides:
        initialize in class AbstractDirectory
      • createIndexes

        protected void createIndexes()
      • hasCollection

        protected boolean hasCollection​(String collection)
        Checks if the MongoDB server has the collection.
        Parameters:
        collection - the collection name
        Returns:
        true if the server has the collection, false otherwise
      • getCollection

        protected com.mongodb.client.MongoCollection<org.bson.Document> getCollection()
        Retrieves the collection associated to this directory.
        Returns:
        the MongoDB collection
      • getCountersCollection

        protected com.mongodb.client.MongoCollection<org.bson.Document> getCountersCollection()
        Retrieves the counters collection associated to this directory.
        Returns:
        the MongoDB counters collection