I have a project Schema like this
const projectSchema = new mongoose.Schema({
name: {
type: String,
required: true,
minlength: 2,
maxlength: 50
},
box: {
type: [String],
required: false,
minlength: 0,
maxlength: 255
},
isActive: Boolean
});
And I need to delete the entry of olibox from different documents
For example:
If I have 4 different projectSchema
IDs and I want to delete 2 specific olibox
IDs from these 4 projectSchemas..how can i dot that?
For one single document I am doing like this to delete one array element..
project= await Project.findByIdAndUpdate(req.project._id,{$pull : {'box': req.params.oliId}},{new :true});
console.log("In post");
Can I use $in
with it somehow?