问题
i use python language to get all keys from couchbase, the following is my code;
function(doc, meta){
emit(null, meta.id);
}
this is view in "namedb" bucket;
from couchbase import Couchbase
db = Couchbase.connect(bucket="namedb", host="192.168.1.170", port=8091)
name = 'key'
view = 'all'
skip=0
limit = 10000
fd = open("name.txt", "a", 0)
num = 1000000
while skip < num:
result = db.query(name, view, use_devmode = False, limit = limit, skip = skip)
for row in result:
fd.write(row.value + '\n')
skip += limit
fd.close()
there have 1000000 documents in this bucket, and when skip = 210000, result variable will get a empty result;
i excute this program many times; when skip = 210000, db.query() function always return empty result; how can i resolve it? how can i get all keys in this bucket? thank you
来源:https://stackoverflow.com/questions/27040667/how-to-get-all-keys-from-couchbase