Refreshing Documents utilizing cURL
You can refresh a record in CouchDB by sending a HTTP solicitation to the worker utilizing PUT strategy through cURL utility. Following is the linguistic structure to refresh a report.
curl -X PUT http://127.0.0.1:5984/database_name/document_id/ -d '{ "field" : "value", "_rev" : "revision id" }'
Model
Assume there is a record with id 001 in the data set named my_database. You can erase this as demonstrated underneath.
Above all else, get the correction id of the record that will be refreshed. You can discover the _rev of the record in the actual archive, in this manner get the report as demonstrated beneath.
$ curl -X GET http://127.0.0.1:5984/my_database/001
{
"_id" : "001",
"_rev" : "2-04d8eac1680d237ca25b68b36b8899d3 " ,
"age" : "23"
}
Use amendment id _rev from the report to refresh the record. Here we are refreshing the age from 23 to 24.
$ curl -X PUT http://127.0.0.1:5984/my_database/001/ -d
' { " age " : " 24 " , " _rev " : " 1-1c2fae390fa5475d9b809301bbf3f25e " } '
{ " ok " : true , " id " : " 001 " , " rev " : " 2-04d8eac1680d237ca25b68b36b8899d3 " }
Check
To check the archive, get the record again utilizing GET demand as demonstrated beneath.
$ curl -X GET http://127.0.0.1:5984/my_database/001
{
" _id " : " 001 ",
" _rev " : " 2-04d8eac1680d237ca25b68b36b8899d3 " ,
" age " : " 23 "
}
Note
Following are some significant focuses to be noted while refreshing a record.
- The URL we send in the solicitation containing the data set name and the record id.
- Refreshing a current archive is same as refreshing the whole record. You can't add a field to a current archive. You can just compose an altogether new form of the record into the data set with a similar archive ID.
- We need to supply the correction number as a piece of the JSON demand.
- Consequently JSON contains the achievement message, the ID of the archive being refreshed, and the new modification data. In the event that you need to refresh the new form of the record, you need to cite this most recent modification number.
Refreshing Documents utilizing Futon
To erase a report open the http://127.0.0.1:5984/_utils/url to get an Overview/file page of CouchDB as demonstrated beneath.
Select the information base in which the record to be refreshed exists and snap it. Here we are refreshing a report in the data set named tutorials_point. You will get the rundown of records in the data set as demonstrated underneath.
Select an archive that you need to refresh and tap on it. You will get the substance of the reports as demonstrated underneath.
Here, to refresh the area from Delhi to Hyderabad, click on the content box, alter the field, and snap the green catch to save the progressions as demonstrated underneath.
