Reputation: 1272
$http.put('/api/datas/' + val[$rootScope.id]._id,val[$rootScope.id].values[0].quantity =$scope.ass);
Above mentioned is the code where val[$rootScope.id]._id
is the id of the field in mongodb and val[$rootScope.id].values[0].quantity
is the quantity which is to be updated and $scope.ass
is the updated value.
How can I update quantity value on MongoDB ?
Upvotes: 0
Views: 68
Reputation: 2923
Try with this code for update database value :
db.databaseName.update(
{ _id: value_of_ID},
{
quantity : value_of_quantity;
},
{ upsert: true }
)
Upvotes: 1