{
"_id" : "1249",
"auth" : {
"_id" : "admin",
"name" : "admin"
},
"content" : "亡官方的冷漠反应",
"title" : "在上海一家外企工作。",
"theme" : "bug",
"dtype" : "all",
"reply" : [
{
"discussname" : {
"_id" : "wzb",
"name" : "wzb"
},
"content" : "\t无言",
"createtime" : ISODate("2004-08-03T15:05:00.000Z"),
"floor" : "1",
"reply" : [
{
"replyname" : {
"_id" : "123",
"name" : "123"
},
"author" : "",
"content" : "不错哦",
"createtime" : ISODate("2016-01-13T08:08:10.081Z")
},
{
"replyname" : {
"_id" : "123",
"name" : "123"
},
"author" : "",
"content" : "jiayouo",
"createtime" : ISODate("2016-01-13T09:27:10.881Z")
},
{
"replyname" : {
"_id" : "123",
"name" : "123"
},
"author" : "回复 123",
"content" : "nihao",
"createtime" : ISODate("2016-01-13T09:27:25.681Z")
}]
},{
"discussname" : {
"_id" : "123",
"name" : "123"
},
"floor" : "2",
"content" : "好帅",
"createtime" : ISODate("2016-01-16T11:04:07.917Z"),
"reply" : [
{
"replyname" : {
"_id" : "123",
"name" : "123"
},
"author" : "",
"content" : "很好",
"createtime" : ISODate("2016-01-16T11:05:21.036Z")
}
]
}
}
像上面的字段,我这样查询:
db.getCollection('tribune').find({"_id":"1249"},{"reply":{"$elemMatch":{"floor":"1"}}})
取出来的里面的reply数组(就叫 A 吧),现在我想取数组A的前两个字段,要怎么做?
Plus de Doudou, plus de Doudou, plus de Doudou, plus de Doudou, plus de Doudou, plus de Doudou, plus de Doudou, plus de Doudou, plus de Doudou, plus de Doudou, plus de