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

$query operator not working in _addSpecial

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0.1
    • Component/s: Shell
    • Labels:
      None
    • ALL

      In the documentation http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24query :

      db.foo.find()._addSpecial( "$query" : {x : {$lt : 5}} )
      // same as
      db.foo.find({x : {$lt : 5}})

      You can try this in shell:

      > db.tmp.insert({"title":1, "field1":"value"})
      > db.tmp.insert({"title":2, "field2":"value"})
      > db.tmp.find({"title":2})
      { "_id" : ObjectId("4ed62f57e5505bab88fae758"), "title" : 2, "field2" : "value" }
      > db.tmp.find()._addSpecial({"$query":{"title":2}})
      { "_id" : ObjectId("4ed62f56e5505bab88fae757"), "title" : 1, "field1" : "value" }
      { "_id" : ObjectId("4ed62f57e5505bab88fae758"), "title" : 2, "field2" : "value" }
      > db.tmp.find({"$query":{"title":2}})
      { "_id" : ObjectId("4ed62f57e5505bab88fae758"), "title" : 2, "field2" : "value" }
      

            Assignee:
            tad Tad Marshall
            Reporter:
            uladzimir_mihura@epam.com Uladzimir Mihura
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: