Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-2092

$mod more strict about params

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical - P2 Critical - P2
    • 01112017-cleanup
    • None
    • None

    Description

      Problem:
      The behaviour of $mod operator has changed from 2.4.x to 2.5.x.

      Impact:
      Backward breaking change

      Reproduce:
      2.4.5

      db.q.drop();
      db.q.insert({ni: {d:20}})
      db.q.find({"ni.d": {$mod: [5]}})
      { "_id" : ObjectId("525dcfbc9acd59e2720c38aa"), "ni" : { "d" : 20 } }
      db.q.find({"ni.d": {$mod: [5,0]}})
      { "_id" : ObjectId("525dcfbc9acd59e2720c38aa"), "ni" : { "d" : 20 } }
      db.q.find({"ni.d": {$mod: [5,0,1]}})
      { "_id" : ObjectId("525dcfbc9acd59e2720c38aa"), "ni" : { "d" : 20 } }

      2.5.3-pre

      db.q.drop();
      db.q.insert({ni: {d:20}})
      db.q.find({"ni.d": {$mod: [5]}})
      error: {
              "$err" : "bad query: BadValue malformed mod, not enough elements",
              "code" : 16810
      }
      db.q.find({"ni.d": {$mod: [5,0]}})
      { "_id" : ObjectId("525dd042e92d3da1f88a3311"), "ni" : { "d" : 20 } }
      db.q.find({"ni.d": {$mod: [5,0,1]}})
      error: {
              "$err" : "bad query: BadValue malformed mod, too many elements",
              "code" : 16810
      }

      )

      Attachments

        Activity

          People

            kay.kim@mongodb.com Kay Kim (Inactive)
            alvin Alvin Richards (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10 years, 17 weeks, 6 days ago