-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.12.0
-
Component/s: Command Operations
-
None
From what I gather, the general contract of the Collection and DB API methods is:
- DB.command() will return a CommandResult to the user who then take responsibility to check ok() or throwOnError() as they wish.
- The "helper" methods that wrap commands, e.g., distinct() call throwOnError for the user automatically.
However from what I see there are several "helpers" that do not, making the pattern sort of inconsistent for users. The examples that I was able to find where throwOnError() is not called:
- DB.getStats()
- Mongo.fsync()
- Mongo.fsyncAndLock()
- DBCollection.aggregate() returning an AggregationOutput