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 self.phone = phone self.email = 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.