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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: mongodb-2.6
    • Fix Version/s: mongodb-2.6
    • Component/s: manual
    • Labels:
    • Environment:
    • # Replies:
      2
    • Last comment by Customer:
      true

      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

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                6 years, 8 weeks, 4 days ago
                Date of 1st Reply: