Document insert

I am new to Mongo and I need to know if I have a user collection with 2 users. Below is the document.

My question is two fold… First, if I insert a document, Do I need to input the fields in the order they are in the record. I.E. email first, then phone.

Or can I just identify the field: value pair and it will be inserted into the field that I have built into the document?

Second… I don’t need all the field upon record creation. I.E. “date_created”, or “date_updated”.

I currently pass the first_name, last_name, phone, email to the class constructor in the python class to create the object…

 def __init__(self, first_name, last_name, phone, email, uid, cart, card):
        self.first_name = first_name
        self.last_name = last_name = phone = email
        self.uid = uid
        self.cart = cart
        self.card = card

But I cannot seem to generate the object fields that I will need to update after record creation. I tried to use the postinit function, but I cannot seem to get the key: value into the object.

Any ideas would be appreciated.

Your issue is not with MongoDB. It is about your object mapper and validation 3rd party. From your previous message I think it is mongoengine.

Mongo has a completely flexible schema and do not enforce field order, field presence or type.

I am not sure if there are a lot of mongoengine users here. May mongoengine has its own forum. Stackoverflow?

Thanks @steevej ,
In my last message I was asking about mongoengine. I have since figured out that I am using pymongo in my project and that mongoengine is not being used in my project.

So… The current issue that I am having is that I cannot figure out how to get fields to initialise in my object without passing them to the init function… So… I think my question is a Python question. I have also asked this on a facebook group for Python programmers.