I want to create a simple collection that stores statistics of different devices. Each device has a unique device id. I want to enforce the uniqueness so I thought to create a unique index for the device id field, But I didn't figured how to tell the collection that this field is of type number.
For example I can receive query with device id '0x3f', '0x0003f', '3f'... and all of them need to match to the same document. I can parse the request before querying the DB but to me it's not sound like the right solution...