I'm using python 3.5.2 and pymongo while trying to store a dict to mongodb
data = {'A':1,'B':2,'C':3}
test = {'A':data['A'], 'B':data['B'], 'C':data['C']}
x = mycol.insert_one(test) #mycol is the name of my collection
But the order of the dict is not preserved while inserting the document into the DB. When i run
print(mycol.find_one())
I get
{'A':1, 'C':3, _id': ObjectId('xxxxxx10f389f63bf0c8bfba'), 'B':2}
instead of
{ _id': ObjectId('xxxxxx10f389f63bf0c8bfba'), 'A':1, 'B':2, 'C':3}
But i was able to preserve the order when i ran it on a system with python 3.6.2. Is the version of python the issue or can i fix it on python 3.5.2 itself?