Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-89

Cannot select only sub-fields to return

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 0.9.6
    • Affects Version/s: None
    • Component/s: Usability
    • None

      there ought to be a way to select only the x.y field to be returned. using {x: {y: 1}} returns both x.y and x.z and using

      {"x.y": 1}

      returns nothing at all.

      > db.bar.find()
      > db.bar.save({x:

      {y: 5, z: 6}

      , w: 2})
      > db.bar.find({}, {x: {y: 1}})
      {"_id" : "4a255950538cba3e38eafcc4" , "x" : {"y" : 5 , "z" : 6}}
      > db.bar.find({},

      {"x.y": 1}

      )
      >

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            mike Michael Dirolf
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: