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)

In[1]:=
Click for copyable input

Connect to a client:

In[1]:=
Click for copyable input
Out[1]=

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

In[1]:=
Click for copyable input
Out[1]=

Find the first document in the collection:

In[1]:=
Click for copyable input
Out[1]=

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

In[1]:=
Click for copyable input
Out[1]=

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

In[1]:=
Click for copyable input
Out[1]=

See Also

MongoCollection  MongoCollectionFind  MongoCollectionCount

Tutorials