1👍
✅
Saves in mongoengine are atomic, however, when saving a list it does it as a $set
for the whole list. So you could have a race condition.
This is why the preferred way to append to a list is to do a $push
eg:
modelObj.update(push__dataList=data)
👤Ross
0👍
table_name.objects.filter(__id=1).update(push__fieldname={‘key’ : ‘value’,’key’ : ‘value’,}) if you want delete than pull
- [Answer]-Django cache Bad Request (400)
- [Answer]-How can I automatically modify a database record after a certain amount of time?
- [Answer]-Django RedirectView that takes an argument
- [Answer]-Filtering or restricting Google-Oauth2 login to a set of users in Django using Python Social Auth
- [Answer]-Insert QuerySet results in a table in Django
Source:stackexchange.com