{
"_id": "4f609932615a935c18r000000",
"members": [
{
"user_name": "john1",
"role": "user",
"created_at": {
"sec": 1331730738,
"usec": 810000
},
{
"user_name": "john2",
"role": "user",
"created_at": {
"sec": 1331730738,
"usec": 810000
},
{
"user_name": "john3",
"role": "user",
"created_at": {
"sec": 1331730738,
"usec": 810000
},
{
"user_name": "john4",
"role": "user",
"created_at": {
"sec": 1331730738,
"usec": 810000
},
{
"user_name": "markus",
"role": "user",
"created_at": {
"sec": 1331730738,
"usec": 810000
}
]
}
我正在尝试在页面上创建分页,因此我正在尝试选择包含数组项的“成员”对象,以便我可以进行排序、跳过、限制到分页。
这就是我所拥有的:
var cursor = db.collection("members").find();
cursor.toArray(function(err, docs) {
"use strict";
if (err) return callback(err, null);
console.log("Found " + docs[0].members.length + " members");
console.log(docs[0].members);
callback(err, docs[0].members);
});
}
如何选择“成员”?
我对此很陌生,请帮助提前谢谢!