如何在ouchdb中获取最后创建的文档? [英] How to get last created document in couchdb?
本文介绍了如何在ouchdb中获取最后创建的文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取上次创建的文档在Sofadb中?也许我该如何使用Couchdb的_changes功能?但是文档说,我只能获取文档列表,按第一个创建的文档排序,但是没有办法更改订单。
How can I get last created document in couchdb? Maybe some how I can use _changes feature of couchdb? But documentation says, that I only can get list of document, ordered by first created document, ant there is no way to change order.
那么如何获取上次创建的文档?
So how can I get last created document?
推荐答案
您也可以按降序获取更改摘要,因为它也是一个视图。
You can get the changes feed in descending order as it's also a view.
GET /dbname/_changes?descending=true
您也可以使用limit =,因此;
You can use limit= as well, so;
GET /dbname/_changes?descending=true&limit=1
将提供最新更新。
这篇关于如何在ouchdb中获取最后创建的文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文