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

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.

主站蜘蛛池模板: 梅河口市| 松滋市| 华坪县| 奇台县| 进贤县| 高陵县| 开原市| 永吉县| 漠河县| 新泰市| 雷波县| 固始县| 思茅市| 茶陵县| 会昌县| 宜昌市| 乌兰察布市| 上饶县| 龙州县| 静乐县| 铜川市| 灵宝市| 谢通门县| 凤台县| 海城市| 中牟县| 孙吴县| 塘沽区| 新龙县| 霍州市| 临湘市| 孙吴县| 旬阳县| 太白县| 无为县| 新民市| 新津县| 大渡口区| 洱源县| 临城县| 应城市|