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

$in operator should require an array

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.5.0
    • None
    • Querying
    • None

    Description

      $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() );

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: