mongodb-schema-miner
Generate schemata from MongoDB collections
Use
$ npm install mongodb-schema-miner
var miner = ;var uri = 'mongodb://someHost:port/database';
By default the first 1000 documents are analyzed. Adjust the number of documents to analyze by setting the limit
option:
var options = {};optionscollection = YOUR_COLLECTION_NAME;optionslimit = 2500;
Analyze specific fields:
var options = {};optionscollection = YOUR_COLLECTION_NAME;optionsfields = _id: 0 content: 1 created: 1 ;
Use a custom query to filter for documents you care about:
var options = {};optionscollection = YOUR_COLLECTION_NAME;optionsquery = count: $gt: 0 ;
Override the type returned by mongodb-schema-miner
:
var options = {};optionscollection = YOUR_COLLECTION_NAME;options { if 'Code' == type return 'Function'; return type;}