I am trying to create the following document in the mongo db but for some reason the document saving the issue object before the data (i presume the default order is by key length). i would like that the issues object will be in the end of the document.
i am using PyMongo from flask_pymongo, i also try the following solution: https://stackoverflow.com/a/30787769/5494424
I try to work with bson and OrderedDict but without success
this is how i create the dict code in python:
gold_apple_report = {
"_id": "",
"updated_on": "",
"data": {
"sms": {
"status": "todo"
},
"catchapp": {
"status": "todo"
},
"telegram": {
"status": "todo"
},
"bookmarks": {
"status": "todo"
},
"calendar": {
"status": "todo"
},
"call_history": {
"status": "todo"
},
"contacts": {
"status": "todo"
},
"files": {
"status": "todo"
},
"downloads": {
"status": "todo"
},
"notes": {
"status": "todo"
},
"posts": {
"status": "todo"
},
"app_list": {
"status": "todo"
},
"media": {
"status": "todo"
},
"locations": {
"status": "todo"
},
"chats": {
"whatsapp": {
"status": "todo"
},
"telegram": {
"status": "todo"
},
"skype": {
"status": "todo"
},
"line": {
"status": "todo"
},
"viber": {
"status": "todo"
},
"facebook": {
"status": "todo"
},
"twitter": {
"status": "todo"
},
"instagram": {
"status": "todo"
}
}
},
"issues": {
}
}
and this is how it appear in the mongoDb:
gold_apple_report = {
"_id": "",
"updated_on": "",
"issues": {
},
"data": {
"sms": {
"status": "todo"
},
"catchapp": {
"status": "todo"
},
"telegram": {
"status": "todo"
},
"bookmarks": {
"status": "todo"
},
"calendar": {
"status": "todo"
},
"call_history": {
"status": "todo"
},
"contacts": {
"status": "todo"
},
"files": {
"status": "todo"
},
"downloads": {
"status": "todo"
},
"notes": {
"status": "todo"
},
"posts": {
"status": "todo"
},
"app_list": {
"status": "todo"
},
"media": {
"status": "todo"
},
"locations": {
"status": "todo"
},
"chats": {
"whatsapp": {
"status": "todo"
},
"telegram": {
"status": "todo"
},
"skype": {
"status": "todo"
},
"line": {
"status": "todo"
},
"viber": {
"status": "todo"
},
"facebook": {
"status": "todo"
},
"twitter": {
"status": "todo"
},
"instagram": {
"status": "todo"
}
}
}
}