I would like to change a MongoDB object id data type to string.
Asked
Active
Viewed 115 times
0
-
You'll likely have to go through the app. Fetch the document, make whatever mutations/transformations you need and save the document back. – Sergio Tulentsev Feb 01 '22 at 14:20
-
if it is object type but not the document _id you can just update with the new value without issues , if it is the document _id it is abit more complicated check here a good answer: https://stackoverflow.com/questions/4012855/how-to-update-the-id-of-one-mongodb-document – R2D2 Feb 01 '22 at 16:22
-
Please provide enough code so others can better understand or reproduce the problem. – Community Feb 10 '22 at 11:08