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

Cannot set batch_size to 1 with MongoDB >= 3.2

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.2.2
    • Affects Version/s: 3.2, 3.2.1
    • Component/s: None
    • None
    • Environment:
      OSX, MongoDB 3.2, WiredTiger

      Trying to get batch_size to be 1 to ensure I don't cache any results. The following works in Javascript but the python equivalent doesnt.

      import pymongo
      
      connection = pymongo.MongoClient()
      mycoll = connection.test.mycoll
      
      mycoll.drop()
      mycoll.insert({'x':1,'v':False})
      mycoll.insert({'x':2,'v':False})
      
      c = mycoll.find().batch_size(1)
      next(c,None)  
      mycoll.update({'x':2},{'$set':{'v':True}})
      next(c,None)  
      
      

      When printing the second record - I expect to get back the record that has been changed. I seem to be seeing a version prior to the change even though I have no batch size set.

      In Javascript 0 it works

      db.mycoll.drop()
      db.mycoll.insert({x:1,v:false})
      db.mycoll.insert({x:2,v:false})
      var c = db.mycoll.find().batchSize(1)
      c.next()
      db.mycoll.update({x:2},{$set:{'v':true}})
      c.next()
      

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            john.page@mongodb.com John Page
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: