急,关于mongodb数组的查询

IDTC 2014-04-22 12:19:36
{
"small_img_url": "5355de685b4b4e9015000002.png",
"big_img_url": "5355de685b4b4e9015000001.png",
"exchange": "1",
"count": 1,
"time_limit": "1",
"content": "1",
"type_id": "5346548b8499344a0c000001",
"game_id": "5338e199cd2c039d7e00000e",
"user_id": "5338d7fa29513b147d000001",
"title": "1",
"_id": "5355de685b4b4e9015000003",
"gift_code": [
{
"code": "1",
"active": false
},
{
"code": "2",
"active": false
},
{
"code": "3",
"active": false
},
{
"code": "4",
"active": true
}
],
"is_shown": true,
"create_at": "2014-04-22T03:13:44.130Z",
"head_img": false
}
这是数据库中查询出来的一条记录,其中有个gift_code数组,但我只想查询其中active为false的记录,该怎么查询啊,谢谢
...全文
98 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
_Will_ 2014-04-25
  • 打赏
  • 举报
回复
db.collection.find({"gift_code.active":false})

1,746

社区成员

发帖
与我相关
我的任务
社区描述
MongoDB相关内容讨论区
社区管理员
  • MongoDB社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧