Sample Header Ad - 728x90

How can i convert all object Ids to string using query in MongoDB, note the structure is complex, So can't use $toString in $addFields and $project?

0 votes
2 answers
4060 views
I have a really deep-nested JSON object generated by aggregation query, but I want to convert all the object ids to string format. Tried $toString in $addFields and $project. Since the object is nested and contains an array of objects with object id. It's difficult to do using this. Is there any other way by which I can convert all object ids to string in MongoDB during querying?
Asked by Manoj Selvin (101 rep)
Jul 27, 2021, 03:13 PM
Last activity: Feb 16, 2024, 07:06 AM