nano-migration
v0.0.2
Published
const nanomigrate = require('nano-migration'), config = { "servername": "http://localhost:5984", "username": "username", "password": "passsword", "databasename": "testdb" }, entities = { document
Downloads
3
Readme
(。◕‿‿◕。)
nano-migration
//example of document migration
//updates a normal document and an update design document
const nanomigrate = require('./app.js'),
config = {
"servername": "http://localhost:5984",
"username": "sammy",
"password": "4892",
"databasename": "navigationdata"
},
entities = [
{
_id: "ip_visits",
visits: [
{ ip: "test", visits: 4 },
{ ip: "test2", visits: 5 },
{ ip: "test3", visits: 1 }
]
},
{
_id: "_design/app",
updates : {
"hello": "function(doc, req) {if (!doc) { if(req.id) {return [{ _id: req.id}, 'New World']}return [null, 'Empty World'];}doc.world = 'hello';doc.edited_by = req.userCtx;return [doc, 'hello doc'];}"
}
}
];
//begin migration
nanomigrate(config, entities);