Closed David-Broderick closed 11 years ago
Ok just a quick hint you can format code via `
your code`
triple ticks without the spaces, to make it a little more readable.
The problem with your code is that db.keys("bkt") returns a stream, which needs to be read first. So try something like this:
var buffer = [];
var keyStream = db.keys("bkt", {}, function(er, data, _meta){
console.log(buffer)
});
keyStream.on("keys", function(keys) { buffer = buffer.concat(keys); });
keyStream.start();
which collects all the keys in the buffer array, the callback is called after the stream finishes so the buffer will contain all the keys.
Thanks so much for your quick response! It works perfectly. And it makes much more sense to make it a stream, so I'm happy for the change.
Thanks again!
No problem, guess we can we close this then?
I reinstalled riak, node.js and riak-js on a new sever (Ubuntu 13.04) and suddenly when I use Riak-JS's db.keys() to get a list of keys in a bucket, it simply never returns.
Here's a test snippet that shows how it fails:
Here's the output:
It doesn't output anything else. I installed the latest Riak (1.4.2), Node.js and Riak-JS (@latest).
Any ideas? Thanks!