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

array element selection syntax returns wrong result

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Operating System:
      ALL

      Description

      Tried the following:

      db = db.getSiblingDB('qa');
      db.foo.save({b:[1, 2, 3, 4]});
      db.foo.find({}, {"b.2":1});

      Result is an empty array:

      { "_id" : ObjectId("4f5f95b285228a256ddccf7e"), "b" : [ ] }

      Is that supposed to work, or are we just not detecting the unsupported syntax?

      Since it has to be quoted anyway, it would be nicer if this worked:

      > db.foo.find({}, {"b[2]":1});
      { "_id" : ObjectId("4f5f95b285228a256ddccf7e") }

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: