Change field type from Object to Array - Keep sub-element contents

When importing 100’s of new documents, I had hoped / intended the document structure for 1 of the fields to be an Array with sub-elements being basic String, Int32 or Double data types.

However, I has changed the Array field into an Object.

How can I now change this back?

If I edit a single document in the Atlas web UI, and change the datatype with the dropdown list to Array it blanks the sub-elements. For seamless update, I would ideally like to retain those contents.

It could be a multi-stage process, such as creating a new Array field, then copy the sub-element data into the new Array, then delete the original Object, then rename the Array. But I expect some expert is aware of the best approach…

1 Like