I am new to MongoDB and python. I know how to make basic use of pymongo in order to manipulate documents.
I am having trouble finding how to create some structure or governance in what gets inside of the database.
Currently, I am storing with a dict {number:'',data:''}
. Recently I wanted to change data
to reg_id
. I missed the change in one place, and that didnt came up until testing. It seems quite horrible that I would have to find every single place that I am accessing the data, and then change the key value of a map. Surely there must be a way or convention that is being used which works for large applications, right?
In my 700 line application it took 2 minutes to change the keys. In a 70k+ line application it would take hours to change all of them. So it seems like I’m doing something wrong.
To summarize my question:
Is using a plain dictionary the correct way of interacting with mongodb?
Or am I supposed to be using a domain-like-class to encapsulate the information I am currently putting in the dictionary?
1