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

$not + $regex gives different error code between 2.4. and 2.5

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • mongodb-2.6
    • mongodb-2.6
    • manual

    Description

      Problem:
      For the given query

      db.q.find( {"s.a": {$not: {$regex:"0"}}})

      2.4.x and 2.5.x give different error codes.

      Reproduce:
      2.4.5

      > db.q.drop();
      true
      > db.q.insert(s: {a: "foo"}})
      > db.q.insert({s: {a: "foo"}})
      > db.q.find( {"s.a": {$not: {$regex:"0"}}})
      error: {
      	"$err" : "can't use $not with $regex, use BSON regex type instead",
      	"code" : 13032
      }

      2.5.3-pre

      > db.q.drop();
      true
      > db.q.insert({s: {a: "foo"}})
      > db.q.find( {"s.a": {$not: {$regex:"0"}}})
      error: { "$err" : "bad query: BadValue $not cannot have a regex", "code" : 16810 }

      Attachments

        Activity

          People

            Unassigned Unassigned
            alvin Alvin Richards (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

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