Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2769

Use the Context passed to "FindOne" in the "SingleResult" as well

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.12.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Currently calling FindOne returns a SingleResult that uses a context.TODO (the same behavior as a context.Background) to fetch results from the underlying cursor (if they weren't returned with the initial batch). That could create a scenario where iterating the underlying cursor hangs indefinitely, violating the user's expectation that the Context passed to FindOne should limit all blocking calls related to the FindOne operation.

      Definition of done:

      • Pass the Context used in FindOne (and all other functions that return a SingleResult) to the SingleResult and use it when fetching the document from the cursor if it hasn't already been returned.
        • Specifically, replace the uses of context.TODO here and here with the Context from the FindOne (or other) function call.

            Assignee:
            preston.vasquez@mongodb.com Preston Vasquez
            Reporter:
            matt.dale@mongodb.com Matt Dale
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: