我正在使用NodeJs和MongoDB开发一个Web应用程序。在数据库中,我得到了一个如下文档:
"user": {
"_id": "525cd98ef8cf50b0006ebcf3",
"name": "alex",
"age": 25,
"gender": "male"
},
"post": {
"_id": "525d3917cb2a20c02380c527",
"title": "Ride bike",
"text": "want to ride bike",
"audience": {
"age": [ 20, 30 ],
"gender": [ "male", female ]
}
}
我需要在post.audience.age年龄和post.audience.gender之间找到user.age的所有帖子,其中包含user.gender。