1
我在一个项目oj NodeJS中工作,我想删除一个包含objets的数组元素。删除一个包含对象的数组MongoDB
的模式是:
{
"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
}
]
}
,我想删除产品3,如何查询是在MongoDB中? “productid”属性是关键,不重复它
谢谢。