Level / leveldown

Pure C++ Node.js LevelDB binding. An abstract-leveldown compliant store.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pls make docs for get and put

rupamking1 opened this issue · comments

I am not able to use put or get please write or make a docs for leveldown

db.open((a1) => {
    p(a1)
    db.put('key', 'value', { sync: true }, (a2) => {
      p(a2)
      db.get('key', { sync: true }, (a3) => {
        p(a3)
      })
    })
})

We can't help you unless you provide more information.

I am not able to use put or get

What doesn't work, specifically?

please write or make a docs for leveldown

What are you missing in the current readme?

db.open(..)

I've edited your code example to make it more readable, but I can't guess what p() is.

I watched your readme file and i tried this, but same problem.
db.open((a1) => { console.log(a1) // output- undefined db.put('key', 'value', { sync: true }, (a2) => { console.log(a2) // output- null db.get('key', { sync: true }, (a3) => { console.log(a3) // output- null }) }) })

The first argument passed to the callbacks is an error (if any). This is documented: https://github.com/Level/leveldown#dbgetkey-options-callback

You'll want:

db.get('key', function (err, value) {
  if (err) throw err

  console.log(value)
})

@vweevers Many many thank you for your help, you are really helpful good person 😇