0

I'm working on mongodb and node.js and i came a across a scenario.

{
  "id": "12345678";
  "contract": {
    "decimalSeparator": "dot",
    "thousandSeparator": "comma"
 }
}

how do i only update thousandSeparator. which query I need to use

Hasibul-
  • 1,192
  • 1
  • 9
  • 18

1 Answers1

1

$set is what you need. https://docs.mongodb.com/manual/reference/operator/update/set/

db.name.update({
    id: '12345678',
    {
        $set: {
            'contract.thousandSeparator': 'newValue'
        }
    }
});
Cristian S.
  • 937
  • 5
  • 13