From the fine manual:
where
collection.where(attributes)
Return an array of all the models in a collection that match the passed attributes.
So when you say this:
var getModel = usersCollection.where(checkIDJSON);
you end up with an array of models in getModel
. If you're sure that there will only be one model that matches, then use findWhere
:
findWhere
collection.findWhere(attributes)
Just like where, but directly returns only the first model in the collection that matches the passed attributes.
like this:
var getModel = usersCollection.findWhere(checkIDJSON);
If there could be multiple matches then presumably you'd want to call set
on each one.