@@ -40,6 +40,7 @@ class Cursor:
4040 "_count" ,
4141 "_cached" ,
4242 "_stats" ,
43+ "_plan" ,
4344 "_profile" ,
4445 "_warnings" ,
4546 "_has_more" ,
@@ -63,6 +64,7 @@ def __init__(
6364 self ._count : Optional [int ] = None
6465 self ._cached = None
6566 self ._stats = None
67+ self ._plan = None
6668 self ._profile = None
6769 self ._warnings = None
6870 self ._next_batch_id : Optional [str ] = None
@@ -132,12 +134,18 @@ def _update(self, data: Json) -> Json:
132134 self ._warnings = extra ["warnings" ]
133135 result ["warnings" ] = extra ["warnings" ]
134136
137+ if "plan" in extra :
138+ self ._plan = extra ["plan" ]
139+ result ["plan" ] = extra ["plan" ]
140+
135141 if "stats" in extra :
136142 stats = extra ["stats" ]
137143 if "writesExecuted" in stats :
138144 stats ["modified" ] = stats .pop ("writesExecuted" )
139145 if "writesIgnored" in stats :
140146 stats ["ignored" ] = stats .pop ("writesIgnored" )
147+ if "documentLookups" in stats :
148+ stats ["lookups" ] = stats .pop ("documentLookups" )
141149 if "scannedFull" in stats :
142150 stats ["scanned_full" ] = stats .pop ("scannedFull" )
143151 if "scannedIndex" in stats :
@@ -159,6 +167,9 @@ def _update(self, data: Json) -> Json:
159167 if "peakMemoryUsage" in stats :
160168 stats ["peak_memory_usage" ] = stats .pop ("peakMemoryUsage" )
161169
170+ if "intermediateCommits" in stats :
171+ stats ["intermediate_commits" ] = stats .pop ("intermediateCommits" )
172+
162173 self ._stats = stats
163174 result ["statistics" ] = stats
164175
@@ -239,6 +250,14 @@ def warnings(self) -> Optional[Sequence[Json]]:
239250 """
240251 return self ._warnings
241252
253+ def plan (self ) -> Optional [Json ]:
254+ """Return query execution plan.
255+
256+ :return: Query execution plan.
257+ :rtype: dict
258+ """
259+ return self ._plan
260+
242261 def empty (self ) -> bool :
243262 """Check if the current batch is empty.
244263
0 commit comments