如何过滤并获取列表mongodb中的特定数组

时间:2015-09-05 17:28:07

标签: node.js mongodb mongoose

我正在使用MongoDB作为数据库创建一个nodejs应用程序。

我只想检索具有"is_active" : "true"

的数组
{
  "response": "206",
  "dev_toast": {
    "_id": "55eab3cb358c513439c3ce5d",
    "flat_tenant": [
      {
        "tenant_id": null,
        "is_active": "false",
        "_id": "55eac5db5e1ddb87104a7865"
      },
      {
        "tenant_id": {
          "_id": "geo@gmail.com",
          "user_first_name": "Geo",
          "user_last_name": "Joy",
          "user_profile_pic": "sampleProfile.jpg",
          "user_phone": "332534",
          "user_permanent_address": "#14th Main"
        },
        "is_active": "true",
        "_id": "55eac6065e1ddb87104a7866"
      },
      {
        "tenant_id": null,
        "is_active": "false",
        "_id": "55ead263232fe9585a86bb7f"
      }
    ]
  },
  "pub_toast": "we found 3 flats."
}

0 个答案:

没有答案