Mongodb. How to get boolean value representing existance of id in an array
of ids?
I've got a model which have property
_idUserReadArr // array of users who have read an article
It it going to be a huge array.
And I want my API to return a boolean value
isRead
Which should be true if _idUserReadArr contains particular id and false in
other case.
So, instead of
_idUserArr = [1, 2, 3]
I want to get isRead = true or isRead = false and do NOT return or do some
manipulations directly with big _idUserReadArr array.
I'n working with node.js using mongoose.
No comments:
Post a Comment