Reputation: 761
I am trying to update a key in the MongoDB document using RESTHear api but the value is not getting updated, however, I am getting 200 OK.
I tried PATCH and PUT both. Below are the URIs I tried.
http PUT "http://localhost:8080/presence/active_watchers?filter={'presentity_uri':'sip:[email protected]'}" event_id=12
http PATCH "http://localhost:8080/presence/active_watchers?filter={'presentity_uri':'sip:[email protected]'}" event_id=12
Both the time I got 200 OK response but the value didn't update.
Am I doing something wrong. I couldn't find any example for this.
I am using Restheart v 2.0.0 Beta.
Upvotes: 0
Views: 737
Reputation: 1253
To bulk update documents matching a filter expression do
http PATCH "http://localhost:8080/presence/active_watchers/*?filter={'presentity_uri':'sip:[email protected]'}" event_id=12
If you PUT/PATCH the URI /presence/active_watchers
you actually update the collection properties (in RESTHeart dbs and collections have their own properties).
To update documents, you need to provide a document URI /db/coll/docid
and for bulk updates you can use the wildcard /db/coll/*?filter=[filter expression]
See Resource URI in the documentation form more information.
Upvotes: 2