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.
更多信息和选项
- To use MongoCollectionFindOne, you first need to load MongoLink using Needs["MongoLink`"].
- Both query and projection are Associations.
- See "Query and Projection Operators" in the MongoDB documentation for available query and projection operators.
- MongoCollectionFindOne corresponds to db.collection.findOne() in the MongoDB documentation.
- See also the "Query Documents" and "Project Fields to Return from Query" tutorials in the MongoDB documentation.
范例
基本范例 (1)
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:
文本
Wolfram Research (2018),MongoCollectionFindOne,Wolfram 语言函数,https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionFindOne.html.
CMS
Wolfram 语言. 2018. "MongoCollectionFindOne." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionFindOne.html.
APA
Wolfram 语言. (2018). MongoCollectionFindOne. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionFindOne.html 年