Package de.bwaldvogel.mongo.backend
Class AbstractMongoCollection<P>
java.lang.Object
de.bwaldvogel.mongo.backend.AbstractMongoCollection<P>
- All Implemented Interfaces:
AsyncMongoCollection,MongoCollection<P>
- Direct Known Subclasses:
AbstractSynchronizedMongoCollection
public abstract class AbstractMongoCollection<P> extends java.lang.Object implements MongoCollection<P>
-
Field Summary
Fields Modifier and Type Field Description protected CursorRegistrycursorRegistryprotected CollectionOptionsoptions -
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMongoCollection(MongoDatabase database, java.lang.String collectionName, CollectionOptions options, CursorRegistry cursorRegistry) -
Method Summary
Modifier and Type Method Description voidaddDocument(Document document)protected abstract PaddDocumentInternal(Document document)voidaddIndex(Index<P> index)intcount(Document query, int skip, int limit)protected CursorcreateCursor(java.util.List<Document> remainingDocuments)protected QueryResultcreateQueryResult(java.util.List<Document> matchedDocuments, int batchSize)intdeleteDocuments(Document selector, int limit, Oplog oplog)protected static DocumentComparatorderiveComparator(Document orderBy)protected booleandocumentMatchesQuery(Document document, Document query)voiddrop()voiddropIndex(java.lang.String indexName)DocumentfindAndModify(Document query)protected PfindDocumentPosition(Document document)java.lang.StringgetCollectionName()MongoDatabasegetDatabase()protected abstract intgetDataSize()protected abstract DocumentgetDocument(P position)protected java.lang.StringgetIdField()java.util.List<Index<P>>getIndexes()DocumentgetStats()DocumenthandleDistinct(Document query)QueryResulthandleQuery(QueryParameters queryParameters)protected abstract voidhandleUpdate(P position, Document oldDocument, Document newDocument)java.util.List<Document>insertDocuments(java.util.List<Document> documents, boolean isOrdered)protected static booleanisNaturalDescending(Document orderBy)protected abstract QueryResultmatchDocuments(Document query, Document orderBy, int numberToSkip, int numberToReturn, int batchSize, Document fieldSelector)protected QueryResultmatchDocuments(Document query, java.lang.Iterable<P> positions, Document orderBy, int numberToSkip, int limit, int batchSize, Document fieldSelector)protected QueryResultmatchDocumentsFromStream(Document query, java.util.stream.Stream<Document> documentStream, int numberToSkip, int limit, int batchSize, java.util.Comparator<Document> documentComparator, Document fieldSelector)protected QueryResultmatchDocumentsFromStream(java.util.stream.Stream<Document> documentStream, Document query, Document orderBy, int numberToSkip, int limit, int batchSize, Document fieldSelector)protected QueryResultqueryDocuments(Document query, Document orderBy, int numberToSkip, int limit, int batchSize, Document fieldSelector)voidremoveDocument(Document document)protected abstract voidremoveDocument(P position)voidrenameTo(MongoDatabase newDatabase, java.lang.String newCollectionName)protected abstract java.util.stream.Stream<DocumentWithPosition<P>>streamAllDocumentsWithPosition()java.lang.StringtoString()protected booleantracksDataSize()protected abstract voidupdateDataSize(int sizeDelta)DocumentupdateDocuments(Document selector, Document updateQuery, ArrayFilters arrayFilters, boolean isMulti, boolean isUpsert, Oplog oplog)Documentvalidate()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface de.bwaldvogel.mongo.MongoCollection
addDocumentIfMissing, count, deleteDocuments, getDatabaseName, getFullName, getNumIndexes, handleQuery, handleQuery, handleQueryAsStream, handleQueryAsync, insertDocuments, isEmpty, queryAll, queryAllAsStream
-
Field Details
-
Constructor Details
-
AbstractMongoCollection
protected AbstractMongoCollection(MongoDatabase database, java.lang.String collectionName, CollectionOptions options, CursorRegistry cursorRegistry)
-
-
Method Details
-
documentMatchesQuery
-
queryDocuments
protected QueryResult queryDocuments(Document query, Document orderBy, int numberToSkip, int limit, int batchSize, Document fieldSelector) -
matchDocuments
protected abstract QueryResult matchDocuments(Document query, Document orderBy, int numberToSkip, int numberToReturn, int batchSize, Document fieldSelector) -
matchDocumentsFromStream
protected QueryResult matchDocumentsFromStream(java.util.stream.Stream<Document> documentStream, Document query, Document orderBy, int numberToSkip, int limit, int batchSize, Document fieldSelector) -
matchDocumentsFromStream
protected QueryResult matchDocumentsFromStream(Document query, java.util.stream.Stream<Document> documentStream, int numberToSkip, int limit, int batchSize, java.util.Comparator<Document> documentComparator, Document fieldSelector) -
matchDocuments
protected QueryResult matchDocuments(Document query, java.lang.Iterable<P> positions, Document orderBy, int numberToSkip, int limit, int batchSize, Document fieldSelector) -
isNaturalDescending
-
deriveComparator
-
getDocument
-
updateDataSize
protected abstract void updateDataSize(int sizeDelta) -
getDataSize
protected abstract int getDataSize() -
addDocumentInternal
-
addDocument
- Specified by:
addDocumentin interfaceMongoCollection<P>
-
getDatabase
- Specified by:
getDatabasein interfaceMongoCollection<P>
-
getCollectionName
public java.lang.String getCollectionName()- Specified by:
getCollectionNamein interfaceMongoCollection<P>
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
addIndex
- Specified by:
addIndexin interfaceMongoCollection<P>
-
drop
public void drop()- Specified by:
dropin interfaceMongoCollection<P>
-
dropIndex
public void dropIndex(java.lang.String indexName)- Specified by:
dropIndexin interfaceMongoCollection<P>
-
getIdField
protected java.lang.String getIdField() -
findAndModify
- Specified by:
findAndModifyin interfaceMongoCollection<P>
-
handleQuery
- Specified by:
handleQueryin interfaceMongoCollection<P>
-
insertDocuments
public java.util.List<Document> insertDocuments(java.util.List<Document> documents, boolean isOrdered)- Specified by:
insertDocumentsin interfaceMongoCollection<P>
-
handleDistinct
- Specified by:
handleDistinctin interfaceMongoCollection<P>
-
deleteDocuments
- Specified by:
deleteDocumentsin interfaceMongoCollection<P>
-
updateDocuments
public Document updateDocuments(Document selector, Document updateQuery, ArrayFilters arrayFilters, boolean isMulti, boolean isUpsert, Oplog oplog)- Specified by:
updateDocumentsin interfaceMongoCollection<P>
-
handleUpdate
-
getIndexes
- Specified by:
getIndexesin interfaceMongoCollection<P>
-
count
- Specified by:
countin interfaceMongoCollection<P>
-
getStats
- Specified by:
getStatsin interfaceMongoCollection<P>
-
removeDocument
- Specified by:
removeDocumentin interfaceMongoCollection<P>
-
tracksDataSize
protected boolean tracksDataSize() -
validate
- Specified by:
validatein interfaceMongoCollection<P>
-
renameTo
- Specified by:
renameToin interfaceMongoCollection<P>
-
removeDocument
-
findDocumentPosition
-
streamAllDocumentsWithPosition
protected abstract java.util.stream.Stream<DocumentWithPosition<P>> streamAllDocumentsWithPosition() -
createQueryResult
-
createCursor
-