Created
June 30, 2014 18:51
-
-
Save nlf/c4518420b1dc21960791 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var levelup = require('levelup'); | |
var riakdown = require('riakdown'); | |
var concat = require('concat-stream'); | |
var db = levelup('riak://localhost:8087/default', {db: riakdown, valueEncoding: 'json'}); | |
db.put('testkey', '{"name": "ham"}', {indexes: [{key: 'name_bin', value: 'ham'}], bucket: 'default'}, function (err, extra) { | |
db.createReadStream({ | |
index: 'name_bin', | |
start: 'ham', | |
end: 'ham', | |
bucket: 'default' | |
}).pipe(concat(function (results) { | |
console.log("results 1"); | |
console.log(results); | |
db.put('testkey', '{"name": "salami"}', {indexes: [{key: 'name_bin', value: 'salami'}], bucket: 'default', vclock: extra.vclock}, function (err) { | |
db.createReadStream({ | |
index: 'name_bin', | |
start: 'ham', | |
end: 'ham', | |
bucket: 'default' | |
}).pipe(concat(function (results) { | |
console.log("results 2"); | |
console.log(results); | |
})); | |
}); | |
})); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment