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

allow returning just the final key when using dot notation

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Querying
    • None

    Description

      When querying with dot notation mongodb returns the full path of the object.
      Most of the times the desired behavior is to get only the final key.
      This feature can be configured with 'shortPath: true' or 'lastKey: true'.

      Let's consider the following doc:
      db.session.save({"userid":"5", "key1": {"key2": "val2"}});

      and a dot notation query:
      db.session.find(

      {"userid":"5"}

      ,

      {"key1.key2":1}

      );

      result:
      [{
      "_id" : ObjectId("4bb72974f9054d050a00489f"),
      "key1" :

      { "key2" : "val2" }

      }]

      I suggest that the result will be:
      [{
      "_id" : ObjectId("4bb72974f9054d050a00489f"),
      "key2" : "val2"
      }]

      Thanks

      Attachments

        Activity

          People

            eliot Eliot Horowitz (Inactive)
            pablo pablo platt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: