Cannot project subfield of _id

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Duplicate
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.4.10, 2.6.1
    • Component/s: Querying
    • None
    • Query
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      if _id is an object you cannot project out on of it's members in a normal projection, you can using $project in aggregation

      > db.foo.insert({_id:{a:1,b:1}})
      WriteResult({ "nInserted" : 1 })
      > db.foo.find({},{_id:0,"_id.a":1})
      {  }
      

              Assignee:
              Backlog - Query Team (Inactive)
              Reporter:
              John Page
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: