Skip to content

Instantly share code, notes, and snippets.

@crtr0
Created August 23, 2015 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crtr0/5736893947020aa02116 to your computer and use it in GitHub Desktop.
Save crtr0/5736893947020aa02116 to your computer and use it in GitHub Desktop.
Insert a document with a compound key using sublevel, and try to read it out.
var Sublevel = require('level-sublevel')
, Levelup = require('levelup')
, bytewise = require('bytewise')
var db = Sublevel(Levelup('./db', {keyEncoding: bytewise, valueEncoding: 'json'}))
var foo = db.sublevel('foo')
foo.put(['carter', 'rabasa'], {eyes: 'brown'}, function(err) {
foo.createReadStream().on('data', console.log)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment