what is actually happening
collectionName.find({id: aVar, isActive: true})
is returning all documents where isActive is true when the variable “aVar” is undefined
Desired Behavior
when aVar is undefined it should return no documents (as none will be active and have an id of undefined)
What I think is happening
I have a vague recollection of reading that meteor applies some transformation to the query object argument to the find function for compatibility reasons. either it was dropping undefined values or converting them to null. However this is not in the documentation of the find function, and I can’t find that information anymore.
My Question
- Is “what I think is happening” happening?
- What are the best practices for handling queries with values that may sometimes be undefined?
Thanks in advance!