官术网_书友最值得收藏!

Time for action — updating a document in Futon

Using Futon, you can easily update the values of this document. Let's go through a quick example.

  1. Make sure you have the document open in your browser.
  2. Note the value of _rev in your document.
  3. Double-click the value of the location field: Seattle, WA, and change it to New York, NY.
  4. Click on Save Document at the top of the page.
  5. Check to make sure that the value of _rev in your document has changed, and that New York, NY is now the value of location.

What just happened?

You just used Futon to change the value of a field in our document and then saved changes to update the document. When the document refreshed, you should have noticed that the _rev field has changed, and your change to the field was updated.

You may have also noticed that Previous Version looks like it's clickable now. Click on it and see what happens. Futon displays the old version of the document with Seattle, WA in the location, as opposed to the new value of New York, NY.

You will now see CouchDB's revisions in full effect. If you want to, you can cycle through all of the versions of the document using the Previous Version and Next Version links.

Note

There are two important things we need to note about CouchDB's revision system:

You cannot update an old version of a document; if you try to save an old version of a document, CouchDB will return a document update conflict error. This is because the only real version of the document is the most current one.

Your revision history is only temporary. If your database kept a record of every single change, it would start to really get bloated. So, CouchDB has a feature called Compaction that will get rid of any of the old revisions.

主站蜘蛛池模板: 驻马店市| 阿尔山市| 通许县| 泾源县| 万载县| 湖南省| 托克托县| 玉田县| 即墨市| 庆阳市| 图们市| 綦江县| 商南县| 朔州市| 德州市| 平塘县| 平罗县| 永德县| 瓦房店市| 桂阳县| 白朗县| 奎屯市| 莱西市| 宿迁市| 扬州市| 额济纳旗| 盐池县| 葵青区| 崇文区| 临夏县| 鹿邑县| 上虞市| 寿宁县| 鄄城县| 富川| 靖西县| 平南县| 余干县| 财经| 富蕴县| 抚州市|