- CouchDB and PHP Web Development Beginner’s Guide
- Tim Juravich
- 315字
- 2021-08-13 18:22:53
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.
- Make sure you have the document open in your browser.
- Note the value of
_rev
in your document. - Double-click the value of the location field: Seattle, WA, and change it to New York, NY.
- Click on Save Document at the top of the page.
- 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.
- Ext JS Data-driven Application Design
- 算法基礎:打開程序設計之門
- Machine Learning with R Cookbook(Second Edition)
- 數據結構(Python語言描述)(第2版)
- Python GUI Programming Cookbook
- Java面向對象程序開發及實戰
- TradeStation交易應用實踐:量化方法構建贏家策略(原書第2版)
- Unity Game Development Scripting
- Swift 4從零到精通iOS開發
- 零基礎學C語言程序設計
- SEO教程:搜索引擎優化入門與進階(第3版)
- Mastering JavaScript
- Mapping with ArcGIS Pro
- INSTANT Lift Web Applications How-to
- Android開發權威指南(第二版)