Class MemoryCollection

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

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

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

        cursors, options
    • Constructor Summary

      Constructors 
      Constructor Description
      MemoryCollection​(de.bwaldvogel.mongo.MongoDatabase database, java.lang.String collectionName, de.bwaldvogel.mongo.backend.CollectionOptions options)  
    • 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 numberToReturn)  
      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.AbstractMongoCollection

        addDocument, addIndex, applySkipAndLimit, count, createCursor, createQueryResult, deleteDocuments, deriveComparator, documentMatchesQuery, drop, dropIndex, findAndModify, getCollectionName, getDatabase, getIdField, getIndexes, getStats, handleDistinct, handleGetMore, handleKillCursors, handleQuery, insertDocuments, isNaturalDescending, matchDocuments, removeDocument, renameTo, sortDocumentsInMemory, toString, updateDocuments, 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

        getDatabaseName, getFullName, getNumIndexes, handleQuery, handleQuery, handleQueryAsStream, queryAll, queryAllAsStream
    • Constructor Detail

      • MemoryCollection

        public MemoryCollection​(de.bwaldvogel.mongo.MongoDatabase database,
                                java.lang.String collectionName,
                                de.bwaldvogel.mongo.backend.CollectionOptions options)
    • 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 numberToReturn)
        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>