Answer the question
In order to leave comments, you need to log in
How to get and check a field from another collection in mongodb?
There are two collections: products, categories. The task is to display products whose category status is true. The product collection looks like this:
Schema({
name: {
type: String,
required: true
},
category: {
type: Schema.Types.ObjectId,
ref: 'categories'
},
})
Schema({
name: {
type: String,
required: true
},
status: {
type: Boolean,
default: true
}
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question