How could I determine all possible keys of a CouchDB database?

独自空忆成欢 提交于 2019-12-05 12:45:40

I have never used stackoverflow before, I saw your question when trying to solve this problem myself so I have signed up. I think this solves your problem:

create a view where "views" includes this:

{ "keys": { "map": "function(doc) { for (var thing in doc) { emit(thing,1); } }", "reduce": "function(key,values) { return sum(values); }" } }

then query on that view with group=true e.g.:

http://localhost:5984/mydb/_design/myview/_view/keys?group=true

you should get back a list of all the keys in your database and a count of how often the occur.

does this help?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!