1

example I got

db.collection.update({}, {$rename: {'XUknown': 'XString'}}, false, true);

I tried in nodejs.

await PRODUCT.update(
    {},
    { $rename: { "product_code": "group_code" } }, false, true
  )
    .then((data) => {
      return res.status(200).json(data)
    })
    .catch((error) => {
      res.status(400).json({ error: error, message: 'not possible' })
    })

response I got ..it not updating

{
    "acknowledged": false
}
Habeeb
  • 322
  • 1
  • 8

1 Answers1

0

I had the same issue... ensure you didn't remove the old field from your schema as at the point of running that command. once you run the command and you check your db and notice the changes has been effected, then you can remove the old field from your schema. else it won't work. That is how i solved mine

boye
  • 11
  • 3