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

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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.5
    • Component/s: None
    • Labels:
      None
    • # Replies:
      2
    • Last comment by Customer:
      true

      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

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since reply:
                  3 years, 11 weeks, 5 days ago
                  Date of 1st Reply: