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

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

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 0.5
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      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)
      

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

              Created:
              Updated:
              Resolved: