Obfusticate sensitive data stored in MongoDB using faker or your own functions.
Installation
npm install --save mongo-obfusticate
Usage
var MongoClient = require('mongodb').MongoClient
, obfusticate = require('mongo-obfusticate')
, schemas = {
'user': {
firstName: 'name.firstName',
lastName: 'name.lastName',
phoneNumber: 123
paymentInfo: {
'account': 123
}
}
}
MongoClient.connect(dbUrl, function (err, dbConnection) {
obfusticate(schemas, dbConnection, callback)
})
API
obfusticate(schemas, dbConnection, cb)
Obfusticates all data in the collections denoted by the keys of the schemas
object (like the example shown above). dbConnection
is an instance of
MongoClient
.
Any top-level keys that are on the schema but are not already on the items in the collection will be ignored.