Skip to content
guileen edited this page Sep 1, 2011 · 4 revisions

Welcome to the node-mongoskin wiki!

Q: 可以对内嵌文档做排序么 ?

A: Retrieving a Subrange of Array Elements You can use the $slice operator to retrieve a subrange of elements in an array.

使用 $slice 选择数组中的一部分。但是无法排序。 // 数组截取 db.posts.find({}, {comments:{$slice: 5}}) // first 5 comments db.posts.find({}, {comments:{$slice: -5}}) // last 5 comments db.posts.find({}, {comments:{$slice: [20, 10]}}) // skip 20, limit 10 db.posts.find({}, {comments:{$slice: [-20, 10]}}) // 20 from end, limit 10

Q: 如何查询内嵌文档?

Q: 如何查询部分字段?

Q: 如何排序?

Q: 如何使用index?

Q: index的优化

Q: 如何写mapreduce?

Q: 是否支持Gridfs?

http://cookbook.mongodb.org/

Clone this wiki locally