Given a collection of MongoDB documents where each document have an array of numbers stored as strings. How do i modify all documents to store the element as numbers instead of strings?
Currently, the documents are structured like this:
{
"coordinates": ["7.83", "58.08"]
}
The desired output would be like this
{
"coordinates": [7.83, 58.08]
}
The collection have 1M+ documents, and solutions that involves processing the documents in code, would not be desirable.
I have tried to use the $toDouble operator combined with $updateMany, without success.