rethinkdb-boundaries
Version:
Downloads, converts, and indexes US Census TIGER data representing all boundaries in the United States to RethinkDB.
24 lines (19 loc) • 490 B
JavaScript
import thinky from 'thinky'
import once from 'once'
export default (opt, cb) => {
cb = once(cb)
const db = thinky(opt)
db.Boundary = db.createModel(opt.table, {
// core fields
id: db.type.string(),
// some display info
name: db.type.string(),
// geojson
geo: db.type.array()
}, {
enforce_extra: 'remove',
enforce_type: 'strict'
})
db.Boundary.ensureIndex('geo', { geo: true, multi: true })
db.dbReady().then(() => cb(null, db)).error(cb)
}