I'm working in a project oj NodeJS, and I want to delete an element of array containing objets.
The Schema is:
{
"products" : [
{
"productid" : 1,
"name" : "product 1",
"price" : 200
},
{
"productid" : 2,
"name" : "product 2",
"price" : 300
},
{
"productid" : 3,
"name" : "product 3",
"price" : 350
},
{
"productid" : 4,
"name" : "product 4",
"price" : 300
},
,
{
"productid" : 5,
"name" : "product 5",
"price" : 300
}
]
}
And i want to delete product 3, how is query in mongodb? the "productid" attribute is key, does not repeat it
Thanks.