-
Type:
Bug
-
Resolution: Works as Designed
-
Priority:
Major - P3
-
None
-
Affects Version/s: 1.0.1, 1.0.0
-
Component/s: CRUD
-
None
-
Environment:Linux, Go 1.12.4, Mongo Docker container created 2019-04-12T00:21:50.281225741Z
-
None
-
None
-
None
-
None
-
None
-
None
-
None
I was writing code to just grab a TODO item with no filter, but kept getting no document. I was able to easily reproduce with the Trainer example; here's a snippet:
// create a value into which the result can be decoded
var result Trainer
//err = collection.FindOne(context.TODO(), filter).Decode(&result)
err = collection.FindOne(context.TODO(), nil).Decode(&result)
if err != nil
With nil for filter:
2019/04/24 10:41:32 document is nil
If I connect using mongo shell:
> db.trainers.findOne()
I'm working around by supplying a filter that's true for all records.