npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mobiq

v1.2.0

Published

Mongo -> BigQuery importer

Downloads

12

Readme

mobiq

Mobiq is a tool for importing mongo collections into google's big query, it supports automatic schema recognition and allows for customer transformations to be plugged in at run time.

It dumps data from mongo using cursor stream api, uploads it to gc storage bucket and runs a big query import from there.

installation

npm i -g --save mobiq

usage

  Usage: mobiq [options]

  Options:

    -V, --version                     output the version number
    -d, --db <dsn>                    mongo DB DSN
    -c, --db-collection <collection>  collection to dump
    --db-query [query]                query for .find()
    --db-limit [limit]                record limit
    --db-skip [skip]                  number of records to skip (default: 0)
    --db-batch [batch]                cursor batch size (default: 1000)
    -p, --bq-project <project>        big query project name
    -s, --bq-dataset <dataset>        big query data set
    -t, --bq-table [table]            big query table, defaults to --db-collection (default: )
    -b, --bq-bucket <bucket>          gc bucket to use for data transfer
    -k, --bq-credentials <file>       gc credentials file (default: )
    --transform-flatten-objects       enables flattening of nested hashes into single dimension ones
    --no-transform-remove-nulls       disables removal of null value keys
    --transform [file]                add transformation stream from file (default: )
    --bq-option [option]              add big query import option key=value (default: [object Object])
    --dump-schema [file]              do not import, just dump schema
    --schema [file]                   use schema from file rather than guessing from files
    --ls-transform                    list available transformations
    -h, --help                        output usage information

using transformations

you can list available transformations with mobiq --ls-transform, you can also provide your own and point at the relevant file via --transform switch.

A transformation is a node transform stream running in object mode which gets each record in a mongo connection.

Example:

const { Transform } = require('stream');

module.exports = class TimestampFromMongoId extends Transform {
    constructor() {
        super({objectMode: true})
    }

    _transform(chunk, encoding, callback) {
        chunk.createdOn = new Date(parseInt(chunk.id.substring(0, 8), 16) * 1000);
        this.push(chunk);
        callback()
    }
}