0.0.2 • Published 7 years ago

nano-migration v0.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

(。◕‿‿◕。)

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);