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

array element selection syntax returns wrong result

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • None
    • None
    • Querying
    • None
    • 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

              Unassigned Unassigned
              dan@mongodb.com Daniel Pasette
              Votes:
              3 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: