Update a document with admin rest API

Is there a way to modify a document with the command line?

I ruined the structure of a document from the application with a bad update and now it crashes.

Looking at the docs, it seems that it is not possible to perform UPDATE operations from command line.

Where is the document you’re trying to modify, and what is crashing?

@loristefano

I take it your are referring to Sync Gateway REST API, you can update a document using PUT against the latest revision e.g.

curl -X PUT http://localhost:4985/db/doc3?rev=1-cd809becc169215072fd567eebd8b8de -H "Content-Type: application/json" -d '{"foo":"bar"}'

Will update doc3 using the named rev 1-… revision as the parent revision and will set the content to {“foo”:“bar”}

The response will include the new rev 2-… revision ID.

1 Like

I solved by messing around with the Android code.