Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions mongo/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,11 @@ func (coll *Collection) Distinct(ctx context.Context, fieldName string, filter i
// For more information about the command, see https://www.mongodb.com/docs/manual/reference/command/find/.
func (coll *Collection) Find(ctx context.Context, filter interface{},
opts ...*options.FindOptions) (cur *Cursor, err error) {

if ctx == nil {
ctx = context.Background()
}

// Omit "maxTimeMS" from operations that return a user-managed cursor to
// prevent confusing "cursor not found" errors. To maintain existing
// behavior for users who set "timeoutMS" with no context deadline, only
Expand All @@ -1217,10 +1222,6 @@ func (coll *Collection) find(
opts ...*options.FindOptions,
) (cur *Cursor, err error) {

if ctx == nil {
ctx = context.Background()
}

f, err := marshal(filter, coll.bsonOpts, coll.registry)
if err != nil {
return nil, err
Expand Down