Class MongoCollection<TDefaultDocument>
Represents a MongoDB collection and the settings used to access it as well as a default document type. This class is thread-safe.
Type Parameters
TDefaultDocument
The default document type of the collection.
- Inheritance
-
MongoCollection<TDefaultDocument>
- Inherited Members
- Extension Methods
Constructors
- Mongo
Collection(Mongo Database, string, Mongo Collection Settings) Creates a new instance of MongoCollection. Normally you would call one of the indexers or GetCollection methods of MongoDatabase instead.
Methods
- Find(IMongo
Query) Returns a cursor that can be used to find all documents in this collection that match the query as TDefaultDocuments.
- Find
All() Returns a cursor that can be used to find all documents in this collection as TDefaultDocuments.
- Find
One() Returns one document in this collection as a TDefaultDocument.
- Find
One(IMongo Query) Returns one document in this collection that matches a query as a TDefaultDocument.
- Find
One ById(Bson Value) Returns a cursor that can be used to find one document in this collection by its _id value as a TDefaultDocument.
- Geo
Haystack Search(Geo Haystack Search Args) Runs a geoHaystack search command on this collection.
- Geo
Haystack Search(double, double, IMongo Geo Haystack Search Options) Runs a geoHaystack search command on this collection.
- Geo
Near(Geo Near Args) Runs a GeoNear command on this collection.
- Geo
Near(IMongo Query, double, double, int) Runs a GeoNear command on this collection.
- Geo
Near(IMongo Query, double, double, int, IMongo Geo Near Options) Runs a GeoNear command on this collection.
- Initialize
Ordered Bulk Operation() Creates a fluent builder for an ordered bulk operation.
- Initialize
Unordered Bulk Operation() Creates a fluent builder for an unordered bulk operation.
- Insert(TDefault
Document) Inserts a document into this collection (see also InsertBatch to insert multiple documents at once).
- Insert(TDefault
Document, Mongo Insert Options) Inserts a document into this collection (see also InsertBatch to insert multiple documents at once).
- Insert(TDefault
Document, Write Concern) Inserts a document into this collection (see also InsertBatch to insert multiple documents at once).
- InsertBatch(IEnumerable<TDefaultDocument>)
Inserts multiple documents at once into this collection (see also Insert to insert a single document).
- InsertBatch(IEnumerable<TDefaultDocument>, MongoInsertOptions)
Inserts multiple documents at once into this collection (see also Insert to insert a single document).
- InsertBatch(IEnumerable<TDefaultDocument>, WriteConcern)
Inserts multiple documents at once into this collection (see also Insert to insert a single document).
- ParallelScan(ParallelScanArgs<TDefaultDocument>)
Scans an entire collection in parallel using multiple cursors.
- Save(TDefault
Document) Saves a document to this collection. The document must have an identifiable Id field. Based on the value of the Id field Save will perform either an Insert or an Update.
- Save(TDefault
Document, Mongo Insert Options) Saves a document to this collection. The document must have an identifiable Id field. Based on the value of the Id field Save will perform either an Insert or an Update.
- Save(TDefault
Document, Write Concern) Saves a document to this collection. The document must have an identifiable Id field. Based on the value of the Id field Save will perform either an Insert or an Update.
- With
Read Concern(Read Concern) Returns a new MongoCollection instance with a different read concern setting.
- With
Read Preference(Read Preference) Returns a new MongoCollection instance with a different read preference setting.
- With
Write Concern(Write Concern) Returns a new MongoCollection instance with a different write concern setting.