Skip to content

Instantly share code, notes, and snippets.

@cdaringe
Created April 22, 2014 21:05
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 cdaringe/11194274 to your computer and use it in GitHub Desktop.
Save cdaringe/11194274 to your computer and use it in GitHub Desktop.
PouchDB relative dir fail
// PouchDB relative dir failure gist
// in some dir containing this .js file, mkdir db
// Run 'node THIS-GIST.js' :: success!
// change one dir up. run 'node childdir/THIS-GIST.js' :: fail :(
var PouchDB = require('pouchdb');
var dbRoot = './db/',
dbTest = new PouchDB(dbRoot + 'pouchdbDirTest'),
now = (new Date()).getTime().toString();
dbTest.put({time: now}, now)
.then(function putS(r){
console.log('Success!');
console.dir(r);
})
.catch(function putF(e){
console.log('Fail!', e.stack);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment