I\'m working with mongoengine in Django, this is my document defination:
class Location(mongoengine.Document): user_id = mongoengine.IntField(req
There is a new way to do it since version 0.9 (explained here):
location = Location.objects(user_id=user_id).modify(upsert=True, new=True, set__point=point)
It returns the created or updated object.