1
可以对mongo数据库中的子数组中的数据进行排序吗?在mongodb中对子数组中的数据进行排序
{ "_id" : ObjectId("4e3f8c7de7c7914b87d2e0eb"),
"list" : [
{
"id" : ObjectId("4e3f8d0be62883f70c00031c"),
"datetime" : 1312787723,
"comments" :
{
"id" : ObjectId("4e3f8d0be62883f70c00031d")
"datetime": 1312787723,
},
{
"id" : ObjectId("4e3f8d0be62883f70c00031d")
"datetime": 1312787724,
},
{
"id" : ObjectId("4e3f8d0be62883f70c00031d")
"datetime": 1312787725,
},
}
],
"user_id" : "3" }
例如,我想按字段“datetime”排序评论。谢谢。或者只是选择所有数据并将其排序在PHP代码中,但是我的查询在mongo的限制下工作...
thx,我已经这样做了,但我认为可以用mongo来做,但Thx用于回复;) –
如果您有解决方案,将它与我们其他人分享会很高兴。 –