Cursor.All() should end implicit session

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 1.1.1
    • Affects Version/s: None
    • Component/s: CRUD
    • None
    • None
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None

      Currently Collection.Find() returns a Cursor and an error.

      The new Cursor.All() method is very helpful, because it allows to load the cursor to a slice.

      However I see 1 major problem: the cursor "API" is exposed to the user, and he must take care of closing it. If I understand correctly, if you don't close it, there is a leak.

      As a developer and reviewer, it's very easy to miss a cursor that isn't closed.

      It would be simpler/safer for a user that calls .All() to close the cursor automatically.

      I see 2 solutions:

              Assignee:
              Alice Thum
              Reporter:
              Pierre Durand
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: