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

'AsyncIOMotorLatentCommandCursor' object has no attribute 'explain'

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.0
    • Affects Version/s: 1.2.1
    • Component/s: asyncio, Docs
    • None

      The docs for AsyncIOMotorCursor mention that there should be an explain method but it doesn't exist with AsyncIOMotorLatentCommandCursor.

      https://motor.readthedocs.io/en/stable/api-asyncio/asyncio_motor_cursor.html#motor.motor_asyncio.AsyncIOMotorCursor.explain]

       

      I get the error:

      'AsyncIOMotorLatentCommandCursor' object has no attribute 'explain'

      Code

        weather = mongo.weather.aggregate([
          {
            "$geoNear": {
              "near": {
                "type": "Point",
                "coordinates": [float(ice_out['lon']), float(ice_out['lat'])]
              },
              "distanceField": "distance",
              "spherical": True,
              "limit": 10000000000,
              "query": {
                "time": {"$gt": start, "$lte": end},
                "snow": {"$ne": 'M'},
              }
            }
          },
          {
            "$group": {
              "_id": "$time",
              "weather": {"$first": "$$ROOT"}
            }
          },
          {"$sort": {"_id": -1}}
        ])
        print(await weather.explain())

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

              Created:
              Updated:
              Resolved: