I want to add a record to the collection if the key doesn't already exist. I understand MongoDB offers the
upsertfor this so I did a
This seems to work.
However in the Python API it says that update is deprecated and use to
raise ValueError('update only works with $ operators') ValueError: update only works with $ operators
I don't really understand why
update_one is different and why I need to use a
$ operator. Can anyone help?