-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
The current implementation of Database.command calls Collection.find() under the covers and iterated the resulting instance of Cursor to retrieve the command result. This seems to be a case of DRY gone off the rails. Command helpers on the Collection and Cursor classes also call back to Database.command, which then calls Collection.find(), creating another Cursor, etc. This is highly inefficient and leads to internal driver behavior that is difficult to reason about.
PyMongo 3.0 will have a simplified command implementation that bypasses Collection.find().