Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-291

Positional Operator in Pymongo Drive seems Broken

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0.1
    • Component/s: None
    • None
    • Environment:
      Ubuntu 11.10
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The positional operator appears to be failing for the pymongo driver.

      Let's say I start off with this:

      user_collection.find_one()
      {
        "_id" : ObjectId("4ec14962960a44259a000001"),
        "email" : "nathan@example.com",
        "last_login" : ISODate("2011-11-14T11:01:22.344Z"),
        "password" : "sha1$445cf$1df2eb52e3f7834566b0fcdfe942cb8f03400c64",
        "permission" : [{
            "account" : "test",
            "type" : "owner"
          }
        ]
      }
      

      When I run this in pymongo:

      spec = {'permission.account': 'test'}
      permission = {
        'account': 'test',
        'type': 'readonly'
      }
      
      user_collection.update(spec, {'permission.$': permission})
      

      It updates the user record to look like the following:

      {
        "_id" : ObjectId("4ec14962960a44259a000001"),
        "permission.$" : {
          "account" : "test",
          "type" : "readonly"
        }
      }
      

      Notice all the other info in record is gone, and the field name is messed up. I am not sure if I am missing something with Mongo driver or if this is a bug or what. Could someone look into this perhaps. Much appreciated.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            bradc Brad Carleton
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: