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

find_one_and_delete doesn't respect skip.

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.5.1
    • Component/s: API, Query Operations
    • Labels:
    • Environment:
      Windows 10
      mongodb 3.4.7

      find_one_and_delete accepts the skip argument (it doesn't throw an error) but it has no effect.

      Example code:

      import pymongo
      
      client = pymongo.MongoClient()
      col = client.db.col
      col.drop()
      
      for val in range(10):
          col.insert_one({'val': val})
      
      print(list(col.find()))
      doc = col.find_one_and_delete({},
                                    sort=[('val', pymongo.ASCENDING)],
                                    skip=4)
      print(doc)
      print(list(col.find()))
      

      I would expect this code to delete the doc with a val of 5 but instead the one with a val of 0 is deleted.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            blimmo Peter Strulo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: