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

array element selection syntax returns wrong result

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

      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") }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            dan@mongodb.com Daniel Pasette (Inactive)
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: