1

This is my collection schema:

    var objectSchema = new Schema({
    members: [{
        user_id: ObjectId,
        settings: {
            type: Boolean
        }
    }],
    title: String
});

And now I'm trying to search for objects with specific members (identified by their "user_id", for example ["asdf123lkd", "asdf1223"]). Is there any way to search for these objects?

Thanks!

1 Answer 1

1

You can try this:

objectModel.find({ 'members.user_id' : {'$in' : ['asdf123lkd', 'asdf1223']} }, function(err, data) {
    console.log(err,data);
})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.