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

$in does not work with nested arrays

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • 1.3.5
    • None
    • None
    • 32-bit 1.3.5 in staging/test environment

    Description

      I have some documents for which I'd like to use composite fields. Something like:

      {id:['x', 1], value:1234}

      and

      {id:['y', 2], value:4321}

      .

      The idea is that I can pull both of those docs by saying:

      db.clxn.find({id:{$in:[['x', 1], ['y', 2]]}}).

      That would let me select just those two in a single query. It doesn't work though. I get no results back using both the JS console and Pymongo.

      This can't be solved by making each component of the composite field into separate fields either. If they were individual fields id_str and id_int and I did:

      db.clxn.find({id_str:{$in:['x', 'y']}, id_int:{$in:[1,2]}})

      I might get back up to 4 documents.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dowski Christian Wyglendowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: