MongoDbCollection class

Inheritance
  • Object
  • DbCollection
  • MongoDbCollection
Implementers

Constructors

MongoDbCollection(Db db, String collectionName)

Properties

collectionName String
getter/setter pairinherited
db ↔ Db
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
readPreference ↔ ReadPreference
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

aggregate(List pipeline, {bool allowDiskUse = false, Map<String, Object>? cursor}) Future<Map<String, dynamic>>
Old version to be used on MongoDb versions prior to 3.6
inherited
aggregateToStream(List<Map<String, Object>> pipeline, {Map<String, Object> cursorOptions = const <String, Object>{}, bool allowDiskUse = false}) Stream<Map<String, dynamic>>
Executes an aggregation pipeline
inherited
bulkWrite(List<Map<String, Object>> documents, {bool ordered = true, WriteConcern? writeConcern}) Future<BulkWriteResult>
inherited
count([dynamic selector]) Future<int>
inherited
createCursor([dynamic selector]) → Cursor
inherited
createIndex({String? key, Map<String, dynamic>? keys, bool? unique, bool? sparse, bool? background, bool? dropDups, Map<String, dynamic>? partialFilterExpression, String? name, bool? modernReply}) Future<Map<String, dynamic>>
This function is provided for all servers starting from version 3.6 For previous releases use the same method on Db class.
inherited
deleteMany(dynamic selector, {WriteConcern? writeConcern, CollationOptions? collation, String? hint, Map<String, Object>? hintDocument}) Future<WriteResult>
inherited
deleteOne(dynamic selector, {WriteConcern? writeConcern, CollationOptions? collation, String? hint, Map<String, Object>? hintDocument}) Future<WriteResult>
inherited
distinct(String field, [dynamic selector]) Future<Map<String, dynamic>>
inherited
drop() Future<bool>
inherited
dropIndexes(Object index, {WriteConcern? writeConcern, String? comment, Map<String, Object>? rawOptions}) Future<Map<String, dynamic>>
inherited
find([dynamic selector]) Stream<Map<String, dynamic>>
Creates a cursor for a query that can be used to iterate over results from MongoDB ##selector parameter represents query to locate objects. If omitted as in find() then query matches all documents in colleciton. Here's a more selective example: find({'last_name': 'Smith'}) Here our selector will match every document where the last_name attribute is 'Smith.'
inherited
findAndModify({dynamic query, dynamic sort, bool? remove, dynamic update, bool? returnNew, dynamic fields, bool? upsert}) Future<Map<String, dynamic>?>
Modifies and returns a single document. By default, the returned document does not include the modifications made on the update. To return the document with the modifications made on the update, use the returnNew option.
inherited
findOne([dynamic selector]) Future<Map<String, dynamic>?>
Returns one document that satisfies the specified query criteria on the collection or view. If multiple documents satisfy the query, this method returns the first document.
inherited
firstDocument() Future<Map<String, dynamic>>
this method depends on the _id property, so if you inserted a custom _id it will sort by your custom _id and this will cause a mis-sorting
fullName() String
inherited
futureFind([dynamic selector]) Future<List<Map<String, dynamic>>>
this just convert the normal stream find method into a future return
getAllDocuments() Future<List<Map<String, dynamic>>>
getIndexes() Future<List<Map<String, dynamic>>>
Analogue of mongodb shell method db.collection.getIndexes() Returns an array that holds a list of documents that identify and describe the existing indexes on the collection. You must call getIndexes() on a collection
inherited
insert(Map<String, dynamic> document, {WriteConcern? writeConcern}) Future<Map<String, dynamic>>
Inserts a document into a collection
inherited
insertAll(List<Map<String, dynamic>> documents, {WriteConcern? writeConcern}) Future<Map<String, dynamic>>
Allows to insert many documents at a time. This is the legacy version of the insertMany() method
inherited
insertMany(List<Map<String, dynamic>> documents, {WriteConcern? writeConcern, bool? ordered, bool? bypassDocumentValidation}) Future<BulkWriteResult>
inherited
insertOne(Map<String, dynamic> document, {WriteConcern? writeConcern, bool? bypassDocumentValidation}) Future<WriteResult>
inherited
lastDocument() Future<Map<String, dynamic>>
this method depends on the _id property, so if you inserted a custom _id it will sort by your custom _id and this will cause a mis-sorting
legacyAggregateToStream(List pipeline, {Map<String, dynamic> cursorOptions = const {}, bool allowDiskUse = false}) Stream<Map<String, dynamic>>
Old version to be used on MongoDb versions prior to 3.6
inherited
legacyCount([dynamic selector]) Future<int>
inherited
legacyDistinct(String field, [dynamic selector]) Future<Map<String, dynamic>>
Old version to be used on MongoDb versions prior to 3.6
inherited
legacyFind([dynamic selector]) Stream<Map<String, dynamic>>
inherited
legacyFindAndModify({dynamic query, dynamic sort, bool? remove, dynamic update, bool? returnNew, dynamic fields, bool? upsert}) Future<Map<String, dynamic>?>
inherited
legacyFindOne([dynamic selector]) Future<Map<String, dynamic>?>
inherited
legacyInsert(Map<String, dynamic> document, {WriteConcern? writeConcern}) Future<Map<String, dynamic>>
Old version to be used on MongoDb versions prior to 3.6
inherited
legacyInsertAll(List<Map<String, dynamic>> documents, {WriteConcern? writeConcern}) Future<Map<String, dynamic>>
Allows to insert many documents at a time. This is the legacy version of the insertMany() method
inherited
legacyRemove(dynamic selector, {WriteConcern? writeConcern}) Future<Map<String, dynamic>>
inherited
legacyUpdate(dynamic selector, dynamic document, {bool upsert = false, bool multiUpdate = false, WriteConcern? writeConcern}) Future<Map<String, dynamic>>
inherited
listIndexes({int? batchSize, String? comment, Map<String, Object>? rawOptions}) Stream<Map<String, dynamic>>
inherited
modernAggregate(dynamic pipeline, {bool? explain, Map<String, Object>? cursor, String? hint, Map<String, Object>? hintDocument, AggregateOptions? aggregateOptions, Map<String, Object>? rawOptions}) Stream<Map<String, dynamic>>
This method returns a stream that can be read or transformed into a list with .toList()
inherited
modernAggregateCursor(dynamic pipeline, {bool? explain, Map<String, Object>? cursor, String? hint, Map<String, Object>? hintDocument, AggregateOptions? aggregateOptions, Map<String, Object>? rawOptions}) → ModernCursor
This method returns a curosr that can be read or transformed into a stream with stream (for a stream you can directly call modernAggregate)
inherited
modernCount({SelectorBuilder? selector, Map<String, Object?>? filter, int? limit, int? skip, CollationOptions? collation, String? hint, Map<String, Object>? hintDocument, CountOptions? countOptions, Map<String, Object>? rawOptions}) Future<CountResult>
inherited
modernDistinct(String field, {dynamic query, DistinctOptions? distinctOptions, Map<String, Object>? rawOptions}) Future<DistinctResult>
Executes a Distinct command on this collection. Retuns a DistinctResult class.
inherited
modernDistinctMap(String field, {dynamic query, DistinctOptions? distinctOptions, Map<String, Object>? rawOptions}) Future<Map<String, Object?>>
Executes a Distinct command on this collection. Retuns a Map like received from the server. Used for compatibility with the legacy method
inherited
modernFind({SelectorBuilder? selector, Map<String, Object?>? filter, Map<String, Object>? sort, Map<String, Object>? projection, String? hint, Map<String, Object>? hintDocument, int? skip, int? limit, FindOptions? findOptions, Map<String, Object>? rawOptions}) Stream<Map<String, dynamic>>
inherited
modernFindAndModify({dynamic query, dynamic sort, bool? remove, dynamic update, bool? returnNew, dynamic fields, bool? upsert, List? arrayFilters, String? hint, Map<String, Object>? hintDocument, FindAndModifyOptions? findAndModifyOptions, Map<String, Object>? rawOptions}) Future<FindAndModifyResult>
inherited
modernFindOne({SelectorBuilder? selector, Map<String, Object?>? filter, Map<String, Object>? sort, Map<String, Object>? projection, String? hint, Map<String, Object>? hintDocument, int? skip, FindOptions? findOptions, Map<String, Object>? rawOptions}) Future<Map<String, dynamic>?>
Returns one document that satisfies the specified query criteria on the collection or view. If multiple documents satisfy the query, this method returns the first document according to the sort order or the natural order of sort parameter is not specified. In capped collections, natural order is the same as insertion order. If no document satisfies the query, the method returns null.
inherited
modernUpdate(dynamic selector, dynamic update, {bool? upsert, bool? multi, WriteConcern? writeConcern, CollationOptions? collation, List? arrayFilters, String? hint, Map<String, Object>? hintDocument}) Future<Map<String, dynamic>>
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(dynamic selector, {WriteConcern? writeConcern}) Future<Map<String, dynamic>>
Removes documents from a collection.
inherited
replaceOne(dynamic selector, Map<String, dynamic> update, {bool? upsert, WriteConcern? writeConcern, CollationOptions? collation, String? hint, Map<String, Object>? hintDocument}) Future<WriteResult>
inherited
save(Map<String, dynamic> document, {WriteConcern? writeConcern}) Future<Map<String, dynamic>>
inherited
toString() String
A string representation of this object.
inherited
update(dynamic selector, dynamic document, {bool upsert = false, bool multiUpdate = false, WriteConcern? writeConcern}) Future<Map<String, dynamic>>
Modifies an existing document or documents in a collection. The method can modify specific fields of an existing document or documents or replace an existing document entirely, depending on the document parameter.
inherited
updateMany(dynamic selector, dynamic update, {bool? upsert, WriteConcern? writeConcern, CollationOptions? collation, List? arrayFilters, String? hint, Map<String, Object>? hintDocument}) Future<WriteResult>
inherited
updateOne(dynamic selector, dynamic update, {bool? upsert, WriteConcern? writeConcern, CollationOptions? collation, List? arrayFilters, String? hint, Map<String, Object>? hintDocument}) Future<WriteResult>
inherited
watch(Object pipeline, {int? batchSize, String? hint, Map<String, Object>? hintDocument, ChangeStreamOptions? changeStreamOptions, Map<String, Object>? rawOptions}) Stream
inherited
watchCursor(Object pipeline, {int? batchSize, String? hint, Map<String, Object>? hintDocument, ChangeStreamOptions? changeStreamOptions, Map<String, Object>? rawOptions}) → ModernCursor
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited