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

support field exclusion for retrieving a subset of fields in a query

    • Type: Icon: New Feature New Feature
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None

      There is support for retrieving a subset of fields in a find operation:

      db.things.find(

      { x : 3 }

      ,

      { z : 1, y: 1 }

      );

      I would like the ability to retrieve all fields except a list of excluded fields, e.g.

      db.things.find(

      { x : 3 }

      , {$exclude : { z : 1, y: 1 }} );

      This would retrieve all fields from matching documents except for z and y.

      The reason this is important for us is because we have several large arrays that we add to every document that we use only for optimizing certain types of searches, but in normal use we don't need to have those fields returned when we actually perform the searches.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jeff_y Jeff Yemin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: