使用CouchDB-Python获取文档级别的修订的完整列表吗? [英] Getting full list of revisions on document level using CouchDB-Python?
问题描述
我正在使用Sofadb-python( http://code.google.com/p/ ouchdb-python / ),我想知道是否有任何方法可以检索文档级别发生的修订的完整列表
?
<假设我有一个名为电影的数据库,它包含几个文档。
我的每个文档都有3个以上的修订版本。
我可以根据修订版本检索文档吗?
如果是,如何?我没有看到使用CouchDB-Python的任何明显方法
我不确定沙发床Python,但是您可以通过HTTP API获取文档的整个已知修订历史记录。
在 CouchDB文档API 文档。
常规查询:
$ curl jhs.couchone.com/db/doc
{_id:'doc',
_rev:'3-825cb35de44c433bfb2df415563a19de'}
添加?revs = true
查看一系列旧修订。
$ curl jhs.couchone.com/db/doc? revs = true
{_id:'doc',
_rev:'3-825cb35de44c433bfb2df415563a19de',
_修订版:
{开头:3,
id:
['825cb35de44c433bfb2df415563a19de',
'7051cbe5c8faecd085a3fa619e6e6337',
'967a00dff5e02add41819138 abb3284d']}}
也可以添加?revs_info = true
获取有关修订的更多详细信息,例如它们是否仍然可用(即它们是在上一次压缩之后添加的,您可以提取它们。)
$ curl jhs.couchone.com/db/doc? revs_info = true
{_id:'doc',
_rev:'3-825cb35de44c433bfb2df415563a19de',
_revs_info:
[{rev:'3-825cb35de44c433bfb2df415563a19de',
状态:'available'},
{修订:'2-7051cbe5c8faecd085a3fa619e6e6337',
状态:'available'}},
{修订:'1-967a00dff5e02add41819138abb3284d',
状态: 'available'}]}
I was working couchdb-python ( http://code.google.com/p/couchdb-python/ ) and i was wondering if I have any way to retrieve a full list of revisions that have occurred on a document level?
Suppose I have a database named "movies" and it contains several documents. Each of my documents have more than 3 revisions.
Can I retrieve my documents based on the revisions?
If yes, how? I didn't see any obvious method to do it using CouchDB-Python
I am not sure about couchdb-python, however you can get the entire known revision history of a document via the HTTP API.
Learn all about it in the CouchDB Document API documentation.
A normal query:
$ curl jhs.couchone.com/db/doc
{ _id: 'doc',
_rev: '3-825cb35de44c433bfb2df415563a19de' }
Add ?revs=true
to see an array of old revisions.
$ curl jhs.couchone.com/db/doc?revs=true
{ _id: 'doc',
_rev: '3-825cb35de44c433bfb2df415563a19de',
_revisions:
{ start: 3,
ids:
[ '825cb35de44c433bfb2df415563a19de',
'7051cbe5c8faecd085a3fa619e6e6337',
'967a00dff5e02add41819138abb3284d' ] } }
Also you can add ?revs_info=true
for more details about the revisions, such as whether they are still available (i.e. they were added after the last compaction and you can fetch them).
$ curl jhs.couchone.com/db/doc?revs_info=true
{ _id: 'doc',
_rev: '3-825cb35de44c433bfb2df415563a19de',
_revs_info:
[ { rev: '3-825cb35de44c433bfb2df415563a19de',
status: 'available' },
{ rev: '2-7051cbe5c8faecd085a3fa619e6e6337',
status: 'available' },
{ rev: '1-967a00dff5e02add41819138abb3284d',
status: 'available' } ] }
这篇关于使用CouchDB-Python获取文档级别的修订的完整列表吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!