MongoDB查询双嵌套数组

时间:2018-12-01 20:08:20

标签: mongodb multidimensional-array

下面是我的mongo db文档,名为business

{
  "_id": ObjectId("5be8e24a6600321ead321466"),
  "business_id": "r89Re4FNgVWHgBfjCVZyVw",
  "name": "Harlow",
  "neighborhood": "Ville-Marie",
  "address": "438 Place Jacques Cartier",
  "city": "Montréal",
  "state": "QC",
  "postal_code": "H2Y 3B3",
  "stars": 3.5,
  "attributes": {
    "Alcohol": "full_bar",
    "BikeParking": "True",
    "BusinessAcceptsCreditCards": "True",
    "BusinessParking": "{'garage': False, 'street': False, 'validated': False, 'lot': False, 'valet': False}",
    "Caters": "False",
    "GoodForMeal": "{'dessert': False, 'latenight': False, 'lunch': False, 'dinner': False, 'breakfast': False, 'brunch': False}",
    "RestaurantsDelivery": "False",
    "RestaurantsGoodForGroups": "True",
  },
  "categories": "Nightlife, Bars, American (Traditional), Tapas/Small Plates, Poutineries, Supper Clubs, Restaurants, Tapas Bars",
}

问题:在上述名称为business的集合中,我需要查找所有提供午餐餐点的餐厅。 (需要检查属性-GoodForMeal-午餐)

它是嵌套数组。请建议我如何使用mongo db

0 个答案:

没有答案