Below is my Schema design
const Schema1 = mongoose.Schema({
_id: false,
id: { type: mongoose.Schema.Types.ObjectId,
ref: 'UserinfoSchema'
},
name: { type: String , default: null },
from: { type: Date, default: Date.now }
})
const ProfileSchema = mongoose.Schema({
profilename:{
type: String,
required: true
},
list:{
acceptedList:[ Schema1 ],
requestedList:[ Schema1 ],
pendingList:[ Schema1 ]
}
})
I want to build a query, which queries in all of the nested arrays(i.e acceptedList, requestedList, pendingList) and find out whether id is present or not and update the requestedList if id is not present in any of the list.
Any of the technique is helpful. Performance is key thing.