Sorry for pushing this, but it's really frustrating and i can't go further with my script since this isn't working correctly. Any help would be really great. :)
over 4 years ago
Hi Nico, my guess would be that in the second case, `docs._id` is actually an instance of the MongoDB ObjectID rather than a plain string, but that the `user._id` stored in your `squaduser` collection is an actual string. Thus, when you try searching using an explicit string, the query works, and when you try using the variable value, it does not. To solve this, you should explicitly cast your `userID` variable to a string when constructing the query.
over 3 years ago
I had the same problem. Casting the variable to string solved this.