find_one_and_delete doesn't respect skip.

XMLWordPrintableJSON

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

      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 Hackett
            Reporter:
            Peter Strulo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: