Class MemoryCollection

  • All Implemented Interfaces:
    de.bwaldvogel.mongo.AsyncMongoCollection, de.bwaldvogel.mongo.MongoCollection<java.lang.Integer>

    public class MemoryCollection
    extends de.bwaldvogel.mongo.backend.AbstractSynchronizedMongoCollection<java.lang.Integer>
    • Field Summary

      • Fields inherited from class de.bwaldvogel.mongo.backend.AbstractMongoCollection

        cursorRegistry, options
    • Constructor Summary

      Constructors 
      Constructor Description
      MemoryCollection​(de.bwaldvogel.mongo.MongoDatabase database, java.lang.String collectionName, de.bwaldvogel.mongo.backend.CollectionOptions options, de.bwaldvogel.mongo.backend.CursorRegistry cursorRegistry)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.Integer addDocumentInternal​(de.bwaldvogel.mongo.bson.Document document)  
      int count()  
      protected java.lang.Integer findDocumentPosition​(de.bwaldvogel.mongo.bson.Document document)  
      protected int getDataSize()  
      protected de.bwaldvogel.mongo.bson.Document getDocument​(java.lang.Integer position)  
      protected void handleUpdate​(java.lang.Integer position, de.bwaldvogel.mongo.bson.Document oldDocument, de.bwaldvogel.mongo.bson.Document newDocument)  
      boolean isEmpty()  
      protected de.bwaldvogel.mongo.backend.QueryResult matchDocuments​(de.bwaldvogel.mongo.bson.Document query, de.bwaldvogel.mongo.bson.Document orderBy, int numberToSkip, int limit, int batchSize, de.bwaldvogel.mongo.bson.Document fieldSelector)  
      protected void removeDocument​(java.lang.Integer position)  
      protected java.util.stream.Stream<de.bwaldvogel.mongo.backend.DocumentWithPosition<java.lang.Integer>> streamAllDocumentsWithPosition()  
      protected void updateDataSize​(int sizeDelta)  
      • Methods inherited from class de.bwaldvogel.mongo.backend.AbstractSynchronizedMongoCollection

        addDocument, deleteDocuments, findAndModify, handleDistinct, handleQuery, insertDocuments, removeDocument, renameTo, updateDocuments
      • Methods inherited from class de.bwaldvogel.mongo.backend.AbstractMongoCollection

        addIndex, count, createCursor, createQueryResult, deriveComparator, documentMatchesQuery, drop, dropIndex, getCollectionName, getDatabase, getIdField, getIndexes, getStats, isNaturalDescending, matchDocuments, matchDocumentsFromStream, matchDocumentsFromStream, queryDocuments, toString, tracksDataSize, validate
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface de.bwaldvogel.mongo.MongoCollection

        addDocumentIfMissing, deleteDocuments, getDatabaseName, getFullName, getNumIndexes, handleQuery, handleQuery, handleQueryAsStream, handleQueryAsync, insertDocuments, queryAll, queryAllAsStream
    • Constructor Detail

      • MemoryCollection

        public MemoryCollection​(de.bwaldvogel.mongo.MongoDatabase database,
                                java.lang.String collectionName,
                                de.bwaldvogel.mongo.backend.CollectionOptions options,
                                de.bwaldvogel.mongo.backend.CursorRegistry cursorRegistry)
    • Method Detail

      • updateDataSize

        protected void updateDataSize​(int sizeDelta)
        Specified by:
        updateDataSize in class de.bwaldvogel.mongo.backend.AbstractMongoCollection<java.lang.Integer>
      • getDataSize

        protected int getDataSize()
        Specified by:
        getDataSize in class de.bwaldvogel.mongo.backend.AbstractMongoCollection<java.lang.Integer>
      • addDocumentInternal

        protected java.lang.Integer addDocumentInternal​(de.bwaldvogel.mongo.bson.Document document)
        Specified by:
        addDocumentInternal in class de.bwaldvogel.mongo.backend.AbstractMongoCollection<java.lang.Integer>
      • matchDocuments

        protected de.bwaldvogel.mongo.backend.QueryResult matchDocuments​(de.bwaldvogel.mongo.bson.Document query,
                                                                         de.bwaldvogel.mongo.bson.Document orderBy,
                                                                         int numberToSkip,
                                                                         int limit,
                                                                         int batchSize,
                                                                         de.bwaldvogel.mongo.bson.Document fieldSelector)
        Specified by:
        matchDocuments in class de.bwaldvogel.mongo.backend.AbstractMongoCollection<java.lang.Integer>
      • count

        public int count()
      • isEmpty

        public boolean isEmpty()
      • findDocumentPosition

        protected java.lang.Integer findDocumentPosition​(de.bwaldvogel.mongo.bson.Document document)
        Overrides:
        findDocumentPosition in class de.bwaldvogel.mongo.backend.AbstractMongoCollection<java.lang.Integer>
      • streamAllDocumentsWithPosition

        protected java.util.stream.Stream<de.bwaldvogel.mongo.backend.DocumentWithPosition<java.lang.Integer>> streamAllDocumentsWithPosition()
        Specified by:
        streamAllDocumentsWithPosition in class de.bwaldvogel.mongo.backend.AbstractMongoCollection<java.lang.Integer>
      • removeDocument

        protected void removeDocument​(java.lang.Integer position)
        Specified by:
        removeDocument in class de.bwaldvogel.mongo.backend.AbstractMongoCollection<java.lang.Integer>
      • getDocument

        protected de.bwaldvogel.mongo.bson.Document getDocument​(java.lang.Integer position)
        Specified by:
        getDocument in class de.bwaldvogel.mongo.backend.AbstractMongoCollection<java.lang.Integer>
      • handleUpdate

        protected void handleUpdate​(java.lang.Integer position,
                                    de.bwaldvogel.mongo.bson.Document oldDocument,
                                    de.bwaldvogel.mongo.bson.Document newDocument)
        Specified by:
        handleUpdate in class de.bwaldvogel.mongo.backend.AbstractMongoCollection<java.lang.Integer>