Create a document with the deviceid property and the rest of the device data, add a property called type and give it the value device. Create a document for each metrics data collected with the devicemetricsid property and all the metrics data, add a property called type and give it the value devicemetrics