Vote count:
0
I am using mongo with spring and I have the _class property in many documents in different collections, at some point I changed my package names and that caused errors with old documents that have the older package name in the _class property. what would be the best way to update the package name in the _class property in all the collections and documents ?
I managed to write a script that does the change for a specific collection ( it also requires recursion as some documents have some nested sub documents ). but I want a solution that would work for all collections.
I tried to just convert the document to a string replace the package name and convert back to json but that caused
_id: ObjectId("5500697dee854093136467ef")
to convert into
"_id" : {
"str" : "5500697dee854093136467ef"
}
Any simple way to achieve this kind of update task ?
update the _class property in all documents
Aucun commentaire:
Enregistrer un commentaire