MongoLink`
MongoLink`

MongoCollectionFindOne

MongoCollectionFindOne[MongoCollection[]]

returns the first document in MongoCollection.

MongoCollectionFindOne[MongoCollection[],query]

returns the first document matching the query query.

MongoCollectionFindOne[MongoCollection[],query,projection]

the fields included in the document are controlled by projection.

Details

Examples

Basic Examples  (1)

Connect to a client:

Connect to a the "WolframTestCollection" collection in the "WolframTestDB" database:

Find the first document in the collection:

Find the first document in the collection that matches the query <|"age"5|>:

Find the first document in the collection that matches the query <|"age"4|>, without returning the "date" field: