Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-124

find() modifies its options argument in an undocumented fashion

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.4
    • Affects Version/s: 1.4
    • Component/s: None
    • Labels:
    • Environment:
      Linux 64-bit Ubuntu

      I am using MongoDB 2.4.9 and version 1.3.23 of the node driver.

      The find() method modifies its options argument. This simple object:

      { hint:

      { path: 1 }

      }

      Becomes (for example - it varies with the query):

      {"skip":0,"limit":0,"raw":false,"hint":null,"slaveOk":false,"read":"primary","selector":{"$and":[{"$and":[{"$and":[{"$and":[{},{"_id":{"$in":["968479889252014764","414733286351587838"]}}]},{}]},

      {"type":"event"}

      ]},{"trash":{"$ne":true}},{"$or":[{"published":true,"loginRequired":{"$exists":false}}]}]},"readPreference":"primary","sort":{"explicitDates.end":1}}

      In this case "hint" became null because I didn't have an index, which makes sense and is not what this ticket is about. My concern is that the object is modified and this behavior is undocumented, so users who expect to turn around and pass that same object for another query may get unexpected results.

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            boutell Thomas Boutell
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: