1
{ "_id" : 0 ,
"prices" : [
{ "type" : "house" , "price" : 10345} ,
{ "type" : "bed" , "price" : 456.94} ,
{ "type" : "carpet" , "price" : 900.45} ,
{ "type" : "carpet" , "price" : 704.48}
]
}
在avobe文檔中,我將如何使用java驅動程序刪除價格最低的地毯?也就是說,我已經刪除{ "type" : "carpet" , "price" : 704.48}
如何使用Java驅動程序訪問在MongoDB中嵌套在數組中的對象
你知道你想要的特定條目刪除(即你知道價格)還是你試圖刪除最低價格? –
@Joachim Isaksson與'type = carpet'的最小值之一 – Towhid
您是否試過用$ pull進行更新:http://docs.mongodb.org/manual/reference/operator/update/pull/? – TeTeT