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

Comparison operators do not work embedded documents

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • 3.1.5
    • Querying
    • None
    • ALL
    • Hide

      > db.t2.insert({"bef" : { "dt" : 20090401 }})
      WriteResult({ "nInserted" : 1 })
      > db.t2.find({"bef" : { "dt" : 20090401 }})
      { "_id" : ObjectId("560c32d8bb3c86325d09eead"), "bef" : { "dt" : 20090401 } }
      > db.t2.find({"bef" : { "dt" : {$lte: 20090401} }})
      > db.t2.find({"bef.dt" : {$lte: 20090401} })
      { "_id" : ObjectId("560c32d8bb3c86325d09eead"), "bef" : { "dt" : 20090401 } }
      

      Show
      > db.t2.insert({"bef" : { "dt" : 20090401 }}) WriteResult({ "nInserted" : 1 }) > db.t2.find({"bef" : { "dt" : 20090401 }}) { "_id" : ObjectId("560c32d8bb3c86325d09eead"), "bef" : { "dt" : 20090401 } } > db.t2.find({"bef" : { "dt" : {$lte: 20090401} }}) > db.t2.find({"bef.dt" : {$lte: 20090401} }) { "_id" : ObjectId("560c32d8bb3c86325d09eead"), "bef" : { "dt" : 20090401 } }

    Description

      If you want to query embedded document, for example, "dt" of {"bef" : { "dt" : 20090401 }} and compare it with a value, simple comparison ({ "dt" : 20090401 }) will work, but $lte/$gte and other comparison operators would not

      Attachments

        Activity

          People

            david.storch@mongodb.com David Storch
            svetasmirnova Sveta
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: