congress-mongodb

Table of contents
Dependencies
CLI
Integration
Install
yarn global add congress-mongodb
congress -h
congress fetch -h
congress sync -h
yarn add congress-mongodb
./node_modules/.bin/congress -h
./node_modules/.bin/congress-fetch -h
./node_modules/.bin/congress-sync -h
Use
Command - fetch
Download sitemaps, json, etc.
congress fetch
congress fetch -d tmp
Command - sync
Import data from files to mongodb in structured format
congress sync
congress sync -d tmp
congress sync -d tmp -u mongodb://localhost:27017/my-db
Integration - connection
Integrate mongoose models in your app
import congress from 'congress-mongodb';
import mongoose from 'mongoose';
congress.connect(mongoose, uri)
.then(db => {
db.Member.find({current: true})
.then(m => {
console.log(m.join('\n'));
});
});
Integration - models
Integrate mongoose models in your app with an existing connection
import congress from 'congress-mongodb';
import mongoose from 'mongoose';
const db = congress.models(mongoose);
db.Member.find({current: true, chamber: 'senate'})
.skip(0)
.limit(50)
.exec()
.then(senate => {
console.log(`Current senators:\n${senate.join('\n')}`)
})
Develop
npm link
congress fetch
congress sync
Todo
- Implement options for more specific fetch/sync
- Implement remove command
License
MIT