MongoCollection class

MongoCollection provides read and write access to documents.

Constructors

MongoCollection({required String collectionName, required String databaseName})

Properties

collectionName String
final
databaseName String
final
hashCode int
The hash code for this object.
no setterinherited
namespace String
The namespace of this collection, i.e. the database and collection names together.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

aggregate(List<PipelineStage> pipeline) Future<List<MongoDocument>>
count([dynamic filter]) Future<int>
Counts the number of all documents in the collection. unless according to the given filter
deleteMany([dynamic filter]) Future<int>
Removes all documents from the collection that matches the given filter. If no documents match, the collection is not modified.
deleteOne([dynamic filter]) Future<int>
Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.
find({dynamic filter, RemoteFindOptions? options}) Future<List<MongoDocument>>
Finds all documents in the collection according to the given filter
findOne({dynamic filter, Map<String, ProjectionValue>? projection}) Future<MongoDocument?>
Finds a document in the collection according to the given filter
insertMany(List<MongoDocument> documents) Future<Map<int, ObjectId>>
Inserts one or more documents to the collection
insertOne(MongoDocument document) Future<ObjectId>
Inserts the provided document to the collection
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateMany({required dynamic filter, required UpdateOperator update}) Future<List>
Update all documents in the collection according to the specified arguments.
updateOne({required dynamic filter, required UpdateOperator update}) Future<List>
Update a single document in the collection according to the specified arguments.
watch({List<String>? ids, bool asObjectIds = true}) Stream
Watches a collection. The resulting stream will be notified of all events on this collection that the active user is authorized to see based on the configured MongoDB rules. can optionally watch only specifies documents with the provided ids
watchWithFilter(Map<String, dynamic>? filter) Stream
Watches a collection. The provided BSON document will be used as a match expression filter on the change events coming from the stream.

Operators

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