Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1254

Some helper methods wrapping commands do not call throwOnError on the result

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.12.3
    • Affects Version/s: 2.12.0
    • Component/s: Command Operations
    • Labels:
      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

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            john.morales@mongodb.com John Morales (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: