Closed marcmmx closed 9 years ago
PUT verb on document URI is supported. It upserts the document with the provided data (in case of updates you need to pass the ETag with the If-Match request header).
Please provide more info: what is the value of person._id? Any log message from restheart? Can you check the actual request with the browser inspector?...
Can you also try the PUT with curl or httpie?
What is the value of the mongo-mount parameter in configuration file?
Thanks for the feedback. I will investigate your suggestions and let you know. I close the issue now.
Please can you provide a small AngularJS PUT example where I can update a person object?
please have a look at the restheart-blog-example, done with AngularJs
this is the file you are interested on:
https://github.com/SoftInstigate/restheart-blog-example/blob/master/app/components/edit/edit.js
it actually uses $http.post, but you can easily modify to use $http.put
Note that if you post a collection with a document not containing the id, a document gets created with a new id (ObjectId). If the data includes an id, and it exists, it will be upated.
Note also that if the id is an ObjectId, you build the URI of the document this way:
$http.put('/db/coll/' + doc._id.$oid, data)....
Thanks again. It worked now.
I try to update a document via Angularjs controller as following
$http.put("/db/persons/"+person._id, person).success(function(result) { ...
and get following error message 127.0.0.1 - - [29/Aug/2015 20:39:44] code 501, message Unsupported method ('PUT')
The security.yml part looks as following: permissions:
Are there any ideas what could be wrong here or is put not supported yet? Thanks.