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

$in check for empty array does not work

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.9.0
    • Affects Version/s: 1.6.5
    • Component/s: Index Maintenance
    • None
    • Environment:
      Ubuntu 10.04.1 LTS, db version v1.6.5, pdfile version 4.5
    • ALL

      The following example is based on the in6.js test:

      t = db.jstests_in6;
      t.drop();

      t.save(

      {key: []}

      );
      t.save(

      {key: [1]}

      );
      t.save(

      {key: ['1']}

      );
      t.save(

      {key: null}

      );
      t.save( {} );

      function doTest() {
      assert.eq.automsg( "1", "t.count(

      {key:[]}

      )" );
      assert.eq.automsg( "1", "t.count( {key:{$in:[[]]}} )" );
      }

      doTest();
      t.ensureIndex(

      {i:1}

      );
      doTest();

      The first query using

      {key: []}

      works as expected as long as there is no index (seems to be the same as http://jira.mongodb.org/browse/SERVER-1943), but the second query {key:{$in:[[]]}} returns nothing in both cases.

            Assignee:
            aaron Aaron Staple
            Reporter:
            koenig Christof Koenig
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: