您的位置:首页 > 数据库 > Mongodb

mongodb sort limit和skip用法

2015-08-13 10:45 573 查看
> db.mediaCollection.find().sort( { $natural: -1 } ).toArray()
[
{
"_id" : ObjectId("5353463193efef02c962da73"),
"Type" : "CD",
"Artist" : "Nirvana",
"Title" : "Nevermind",
"Tracklist" : [
{
"Track" : "1",
"Title" : "Smells like teen spirit",
"Length" : "5:02"
},
{
"Track" : "2",
"Title" : "In Bloom",
"Length" : "4:15"
}
]
},
{
"_id" : ObjectId("5353462f93efef02c962da72"),
"Type" : "CD",
"Artist" : "Nirvana",
"Title" : "Nevermind"
},
{
"_id" : ObjectId("5353462f93efef02c962da71"),
"Type" : "Book",
"Title" : "Definitive Guide to MongoDB, the",
"ISBN" : "987-1-4302-3051-9",
"Publisher" : "Apress",
"Author" : [
"Membrey, Peter",
"Plugge, Eelco",
"Hawkins, Tim"
]
}
]


View Code
转载至http://blog.fens.me/nodejs-mongoose-json/,
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: