January 4, 2016
MongoDB 教程三: 高级查询 (SQL到MongoDB映射表)
MongoDB 系列教程索引 : MongoDB 教程索引 (附有视频)
查询接口
对于查询操作,MongoDB 提供了 db.collection.find() 方法。这个方法接收查询条件和映射两个条件并且返回一个指向匹配文档的 游标 。你可以使用 limits, skip 和 sort orders 来有选择的修饰查询。
下图把 MongoDB 查询操作组成部分进行了高亮显示:
The components of a MongoDB find operation.
下图展示了使用 SQL 的相同查询:
The components of a SQL SELECT statement.
例子
db.users.find( { age: { $gt: 18 } }, { name: 1, ad… Read More