C# Class MongoDB.Driver.Collection

Inheritance: IMongoCollection
Datei anzeigen Open project: sdether/mongodb-csharp Class Usage Examples

Private Properties

Property Type Description
CheckError void
CheckPreviousError void

Public Methods

Method Description
Collection ( string name, Connection conn, string dbName ) : System
Count ( ) : long

Count all items in the collection.

Count ( Document spec ) : long

Count all items in a collection that match the query spec.

It will return 0 if the collection doesn't exist yet.

Delete ( Document selector ) : void

Deletes documents from the collection according to the spec.

An empty document will match all documents in the collection and effectively truncate it.

Delete ( Document selector, bool safemode ) : void

Deletes documents from the collection according to the spec.

An empty document will match all documents in the collection and effectively truncate it.

Find ( Document spec ) : ICursor
Find ( Document spec, int limit, int skip ) : ICursor
Find ( Document spec, int limit, int skip, Document fields ) : ICursor
Find ( String where ) : ICursor
FindAll ( ) : ICursor
FindOne ( Document spec ) : Document

Finds and returns the first document in a query.

Insert ( Document doc ) : void
Insert ( Document doc, bool safemode ) : void

Inserts the Document into the collection.

Insert ( IEnumerable docs ) : void
Insert ( IEnumerable docs, bool safemode ) : void
MapReduce ( ) : MapReduce

Entrypoint into executing a map/reduce query against the collection.

MapReduceBuilder ( ) : MapReduceBuilder
Save ( Document doc ) : void

Saves a document to the database using an upsert.

The document will contain the _id that is saved to the database. This is really just an alias to Update(Document) to maintain consistency between drivers.

Update ( Document doc ) : void

Updates a document with the data in doc as found by the selector.

_id will be used in the document to create a selector. If it isn't in the document then it is assumed that the document is new and an upsert is sent to the database instead.

Update ( Document doc, Document selector ) : void

Updates a document with the data in doc as found by the selector.

Update ( Document doc, Document selector, UpdateFlags flags ) : void

Updates a document with the data in doc as found by the selector.

Update ( Document doc, Document selector, UpdateFlags flags, bool safemode ) : void
Update ( Document doc, Document selector, bool safemode ) : void
Update ( Document doc, Document selector, int flags ) : void
Update ( Document doc, Document selector, int flags, bool safemode ) : void
Update ( Document doc, bool safemode ) : void
UpdateAll ( Document doc, Document selector ) : void

Runs a multiple update query against the database. It will wrap any doc with $set if the passed in doc doesn't contain any '$' ops.

UpdateAll ( Document doc, Document selector, bool safemode ) : void

Private Methods

Method Description
CheckError ( bool safemode ) : void
CheckPreviousError ( bool safemode ) : void

Method Details

Collection() public method

public Collection ( string name, Connection conn, string dbName ) : System
name string
conn Connection
dbName string
return System

Count() public method

Count all items in the collection.
public Count ( ) : long
return long

Count() public method

Count all items in a collection that match the query spec.
It will return 0 if the collection doesn't exist yet.
public Count ( Document spec ) : long
spec Document
return long

Delete() public method

Deletes documents from the collection according to the spec.
An empty document will match all documents in the collection and effectively truncate it.
public Delete ( Document selector ) : void
selector Document
return void

Delete() public method

Deletes documents from the collection according to the spec.
An empty document will match all documents in the collection and effectively truncate it.
public Delete ( Document selector, bool safemode ) : void
selector Document
safemode bool
return void

Find() public method

public Find ( Document spec ) : ICursor
spec Document
return ICursor

Find() public method

public Find ( Document spec, int limit, int skip ) : ICursor
spec Document
limit int
skip int
return ICursor

Find() public method

public Find ( Document spec, int limit, int skip, Document fields ) : ICursor
spec Document
limit int
skip int
fields Document
return ICursor

Find() public method

public Find ( String where ) : ICursor
where String
return ICursor

FindAll() public method

public FindAll ( ) : ICursor
return ICursor

FindOne() public method

Finds and returns the first document in a query.
public FindOne ( Document spec ) : Document
spec Document /// A representing the query. ///
return Document

Insert() public method

public Insert ( Document doc ) : void
doc Document
return void

Insert() public method

Inserts the Document into the collection.
public Insert ( Document doc, bool safemode ) : void
doc Document
safemode bool
return void

Insert() public method

public Insert ( IEnumerable docs ) : void
docs IEnumerable
return void

Insert() public method

public Insert ( IEnumerable docs, bool safemode ) : void
docs IEnumerable
safemode bool
return void

MapReduce() public method

Entrypoint into executing a map/reduce query against the collection.
public MapReduce ( ) : MapReduce
return MapReduce

MapReduceBuilder() public method

public MapReduceBuilder ( ) : MapReduceBuilder
return MapReduceBuilder

Save() public method

Saves a document to the database using an upsert.
The document will contain the _id that is saved to the database. This is really just an alias to Update(Document) to maintain consistency between drivers.
public Save ( Document doc ) : void
doc Document
return void

Update() public method

Updates a document with the data in doc as found by the selector.
_id will be used in the document to create a selector. If it isn't in the document then it is assumed that the document is new and an upsert is sent to the database instead.
public Update ( Document doc ) : void
doc Document
return void

Update() public method

Updates a document with the data in doc as found by the selector.
public Update ( Document doc, Document selector ) : void
doc Document
selector Document
return void

Update() public method

Updates a document with the data in doc as found by the selector.
public Update ( Document doc, Document selector, UpdateFlags flags ) : void
doc Document The to update with ///
selector Document /// The query spec to find the document to update. ///
flags UpdateFlags /// ///
return void

Update() public method

public Update ( Document doc, Document selector, UpdateFlags flags, bool safemode ) : void
doc Document
selector Document
flags UpdateFlags
safemode bool
return void

Update() public method

public Update ( Document doc, Document selector, bool safemode ) : void
doc Document
selector Document
safemode bool
return void

Update() public method

public Update ( Document doc, Document selector, int flags ) : void
doc Document
selector Document
flags int
return void

Update() public method

public Update ( Document doc, Document selector, int flags, bool safemode ) : void
doc Document
selector Document
flags int
safemode bool
return void

Update() public method

public Update ( Document doc, bool safemode ) : void
doc Document
safemode bool
return void

UpdateAll() public method

Runs a multiple update query against the database. It will wrap any doc with $set if the passed in doc doesn't contain any '$' ops.
public UpdateAll ( Document doc, Document selector ) : void
doc Document
selector Document
return void

UpdateAll() public method

public UpdateAll ( Document doc, Document selector, bool safemode ) : void
doc Document
selector Document
safemode bool
return void