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

Cannot set batch_size to 1 with MongoDB >= 3.2

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 3.2, 3.2.1
    • Fix Version/s: 3.2.2
    • Component/s: None
    • Security Level: Public
    • Labels:
      None
    • Environment:
      OSX, MongoDB 3.2, WiredTiger
    • Sprint:
      Python Sprint 33

      Description

      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()
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: