I need to import a large amount of records into MongoDB. However, they are in XML format. I have converted XML file to Json equivalent using python. However, later on when I started building mongo queries against that data some of them wouldn’t execute. Apparently, a certain field in a document was imported as a plain value because it was just one value. But it should have been an array since some other documents had array of values for the same field.
Is there a best practice around in defining JSON structure for MongoDB Documents. Such as, if at least one value in the document is an array of values than all documents should define an array type for that particular field?