Hi @Jason_W,
Every driver call that may block requires a context to be passed in. If you’re willing to let the call block for as long as necessary, you can use context.Background() for this. If you want to have a specific timeout for the entire call, you can use WithTimeout as the examples do. You can also use context.WithCancel if you want to provide a cancellable context with no timeout.
Thanks for pointing out the disregarded context.CancelFunc return value. I’ve opened Add deferred context cancellations to README examples by divjotarora · Pull Request #441 · mongodb/mongo-go-driver · GitHub to fix this in our README examples.
– Divjot