Module: reincarnate

  • Setup new database
  • If database is not exists, create new database then push sample data to it
  • If database is early exists, drop database then push sample data to it
Parameters:
Name Type Description
db module:database.Database

Instance of database

assetDir module:database.AssetDir

Path to directory contains static data

callback StdCallback

Function will be call after done

Source:
Example
// see constructor for detail
const reincarnate = require('./lib/reincarnate')
const mongodb = require('mongodb')
const path = require('path')

var db = mongodb.MongoClient.connect(url)
var asset = path.join(__dirname, 'asset/static')

reincarnate(db, asset, function(err) {
  if (err) return

  // do something here
})