[Pkg-javascript-commits] [node-leveldown] 161/492: change createIfMissing default to true

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:13:55 UTC 2014


This is an automated email from the git hooks/post-receive script.

andrewrk-guest pushed a commit to annotated tag rocksdb-0.10.1
in repository node-leveldown.

commit 364f05e7b89291bb39ee02d523be02cfe725d6e5
Author: Rod Vagg <rod at vagg.org>
Date:   Wed Jan 9 12:51:41 2013 +1100

    change createIfMissing default to true
---
 README.md      | 5 ++---
 lib/levelup.js | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index c11e965..e837192 100644
--- a/README.md
+++ b/README.md
@@ -46,8 +46,7 @@ var levelup = require('levelup')
 
 // 1) Create our database, supply location and options.
 //    This will create or open the underlying LevelDB store.
-var options = { createIfMissing: true, errorIfExists: false }
-var db = levelup('./mydb', options)
+var db = levelup('./mydb')
 
 // 2) put a key & value
 db.put('name', 'LevelUP', function (err) {
@@ -113,7 +112,7 @@ db.get('foo', function (err, value) {
 
 `levelup()` takes an optional options object as its second argument; the following properties are accepted:
 
-* `'createIfMissing'` *(boolean, default: `false`)*: If `true`, will initialise an empty database at the specified location if one doesn't already exist. If `false` and a database doesn't exist you will receive an error in your `open()` callback and your database won't open.
+* `'createIfMissing'` *(boolean, default: `true`)*: If `true`, will initialise an empty database at the specified location if one doesn't already exist. If `false` and a database doesn't exist you will receive an error in your `open()` callback and your database won't open.
 
 * `'errorIfExists'` *(boolean, default: `false`)*: If `true`, you will receive an error in your `open()` callback if the database exists at the specified location.
 
diff --git a/lib/levelup.js b/lib/levelup.js
index 876dcbd..ecd7318 100644
--- a/lib/levelup.js
+++ b/lib/levelup.js
@@ -16,7 +16,7 @@ var bridge       = require('bindings')('levelup.node')
   , encodings    = require('./util').encodings
 
   , defaultOptions = {
-        createIfMissing : false
+        createIfMissing : true
       , errorIfExists   : false
       , encoding        : 'utf8'
       , keyEncoding     : null

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-leveldown.git



More information about the Pkg-javascript-commits mailing list