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.
public class MongoCollection<TDefaultDocument> : MongoCollection
Type Parameters
TDefaultDocument
The default document type of the collection.
- Inheritance
-
MongoCollection<TDefaultDocument>
- Inherited Members
- Extension Methods
Constructors
- MongoCollection(MongoDatabase, string, MongoCollectionSettings)
Creates a new instance of MongoCollection. Normally you would call one of the indexers or GetCollection methods of MongoDatabase instead.
Methods
- Find(IMongoQuery)
Returns a cursor that can be used to find all documents in this collection that match the query as TDefaultDocuments.
- FindAll()
Returns a cursor that can be used to find all documents in this collection as TDefaultDocuments.
- FindOne()
Returns one document in this collection as a TDefaultDocument.
- FindOne(IMongoQuery)
Returns one document in this collection that matches a query as a TDefaultDocument.
- FindOneById(BsonValue)
Returns a cursor that can be used to find one document in this collection by its _id value as a TDefaultDocument.
- GeoHaystackSearch(GeoHaystackSearchArgs)
Runs a geoHaystack search command on this collection.
- GeoHaystackSearch(double, double, IMongoGeoHaystackSearchOptions)
Runs a geoHaystack search command on this collection.
- GeoNear(GeoNearArgs)
Runs a GeoNear command on this collection.
- GeoNear(IMongoQuery, double, double, int)
Runs a GeoNear command on this collection.
- GeoNear(IMongoQuery, double, double, int, IMongoGeoNearOptions)
Runs a GeoNear command on this collection.
- InitializeOrderedBulkOperation()
Creates a fluent builder for an ordered bulk operation.
- InitializeUnorderedBulkOperation()
Creates a fluent builder for an unordered bulk operation.
- Insert(TDefaultDocument)
Inserts a document into this collection (see also InsertBatch to insert multiple documents at once).
- Insert(TDefaultDocument, MongoInsertOptions)
Inserts a document into this collection (see also InsertBatch to insert multiple documents at once).
- Insert(TDefaultDocument, WriteConcern)
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(TDefaultDocument)
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(TDefaultDocument, MongoInsertOptions)
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(TDefaultDocument, WriteConcern)
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.
- WithReadConcern(ReadConcern)
Returns a new MongoCollection instance with a different read concern setting.
- WithReadPreference(ReadPreference)
Returns a new MongoCollection instance with a different read preference setting.
- WithWriteConcern(WriteConcern)
Returns a new MongoCollection instance with a different write concern setting.