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

$in operator should require an array

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.0
    • Affects Version/s: None
    • Component/s: Querying
    • None

      $in should take a list (array) of values. But it currently also accepts an object. An object should probably trigger a query parse error.

      c = db.c;
      c.drop();
      
      c.save( { a:1 } );
      c.save( { a:2 } );
      c.save( { a:3 } );
      
      // Works
      printjson( c.find( { a:{ $in:[ 1, 3 ] } } ).toArray() );
      // Works the same as the above line, but it should probably be uassert.
      printjson( c.find( { a:{ $in:{ x:1, y:3 } } } ).toArray() );
      

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: