umutbozkurt / django-rest-framework-mongoengine

Mongoengine support for Django Rest Framework
MIT License
616 stars 167 forks source link

mongoengine partial update document #251

Open ecomdevsolutions opened 6 years ago

ecomdevsolutions commented 6 years ago

How can I update the document partially from view? I used partial_update() SQL databases such as PostGreSQL, MySQL but I am not sure how can I update mongoDB document with several properties.

i.e when mongo query is like below, how can I write in Django rest framework view. db.products.update( { _id: 100 }, { $set: { quantity: 500, details: { model: "14Q3", make: "xyz" }, tags: [ "coats", "outerwear", "clothing" ] } } )

BurkovBA commented 6 years ago

I'm afraid, partial updates are not entirely stable. See test_partial.py for examples.

ecomdevsolutions commented 6 years ago

@BurkovBA no way to update document partially?

BurkovBA commented 6 years ago

No, there is a way, PATCH requests, but their handling might contain bugs. If you run into them - you're welcome to introduce your fixes as Pull Requests.