Home > database >  Could you tell me directing a nested document
Could you tell me directing a nested document

Time:09-17

How to make the nested document number plus one, not the
Db. Order. Update (
{title: {$regex: ^ merchandise shopping list/},
Detail: {$elemMatch: {name: "flour," price: {$lte: 30}}}},
{$inc: {" detail. Detail ": {price: 5}}},
{multi: true}
)
Error: & gt; [Error] index 0:14 - always increment with non - numeric argument: {detail. Detail: {price: 5.0}}

CodePudding user response:

Db. Order. Update (
{title: {$regex: ^ merchandise shopping list/},
Detail: {$elemMatch: {name: "flour," price: {$lte: 30}}}},
{$inc: {detail: {price: 5}}},
{multi: true}
)

CodePudding user response:

Fix the db. The order. The update (
{title: {$regex: ^ merchandise shopping list/},
Detail: {$elemMatch: {name: "flour," price: {$lte: 30}}}},
{$inc: {detail. $. "price" : 5}},
{multi: true}
)
  • Related