Uploaded image for project: 'Motor'
  1. Motor
  2. MOTOR-84

Drop support for indexing Motor cursors with "[n]"

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 0.5
    • None
    • None

    Description

      Breaking change. Implementing this API for Motor was a mistake:

      @gen.coroutine                                            
      def fifth_item():                                         
          yield collection.insert([{'i': i} for i in range(10)])
          cursor = collection.find().sort([('i', 1)])[5]        
          yield cursor.fetch_next                               
          doc = cursor.next_object()                            
      

      Require users to set skip and limit longhand:

      @gen.coroutine
      def fifth_item():
          yield collection.insert([{'i': i} for i in range(10)])
          cursor = collection.find().sort([('i', 1)]).skip(5).limit(1)
          yield cursor.fetch_next
          doc = cursor.next_object()
          print(doc['i'])
       
      IOLoop.current().run_sync(fifth_item)
      

      Attachments

        Issue Links

          Activity

            People

              jesse@mongodb.com A. Jesse Jiryu Davis
              jesse@mongodb.com A. Jesse Jiryu Davis
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: