GoLang mgo - mgo.ErrNotFound for find(...).All(...)

Viewed 3606

I have a GoLang code:

c.Find(selectQuery).All(&results)
if err == mgo.ErrNotFound {
// error handling
}

selectQuery value is not important here.

I never get error ErrNotFound. Even if the query doesn't match any results I don't get ErrNotFound. I get variable result with empty attributes. How should I change the code to handle ErrNotFound case?

1 Answers
Related