This is what I tred
removeFromCart:(userId)=>{
return new Promise(async (resolve,reject)=>{
db.get().collection(collection.CART_COLLECTION).updateOne({_id:userId},
{
$pull:{
products
}
}
)
resolve(response)
})
}
This is the structure of my database, after placing the orde, I have to remove the cart array , Then what I have to do?
{
"_id": {
"$oid": "633abca2f9a57f6470904812"
},
"user": {
"$oid": "633ab3c11e6e97b6332f56a1"
},
"products": [
{
"item": {
"$oid": "63314b0c07e279ee33c55caf"
},
"quantity": 2
}
]
}