【问题标题】:Get specific list of collection from a mongo DB collection从 mongoDB 集合中获取特定的集合列表
【发布时间】:2019-11-03 18:25:11
【问题描述】:

我在 mongo DB 中有一个包含电影、系列和产品详细信息的文档的集合。格式如下: { 产品名称, 产品, 电影 : [{movie1},{movie2}] , 系列: [{系列1},{系列2}] } 我只想获得带有 product id 的电影。目前能够按产品 ID 应用过滤器并获取整个文档,但该文档将包含偶数系列。如何限制只获取电影?

【问题讨论】:

    标签: c# .net mongodb collections


    【解决方案1】:

    您可以使用 find 语句中的投影选项:

    https://docs.mongodb.com/manual/reference/method/db.collection.find/

    db.collection.find({productid},{series:0})
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-31
      • 2021-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多