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

mdb-conduit

v0.0.4

Published

Provides a native interface to a MongoDB-style aggregation pipeline

Downloads

12

Readme

This node modules makes MongoDB's aggregation pipeline (henceforce pipeline) available for use in NodeJS.

Potential uses

  • As a utility to explore bson dumps and/or transform json data.
  • Provide a common API to query data in an application (one DSL).
  • Pre/post-processing of data returned by MongoDB.
  • Test out ideas for new pipeline functionality.
  • Profile pipeline operations more easily.

Installation

  • npm install mdb-conduit
  • There will be a mdb-conduit program installed in node_modules/.bin.

Examples

  • As a command.
     echo '[{v:5},{v:1},{v:3},{v:4},{v:2},{v:0}]' >> array.json
     mdb-conduit -e '[{$sort:{v:1}}]' array.json
  • Programmatically.
     var mdb_conduit = require('mdb-conduit'),
           pipeline = [{$sort:{v:1}}],
           docs = [{v:5},{v:1},{v:3},{v:4},{v:2},{v:0}];
    
     mdb_conduit.aggregate(pipeline, docs, function(err, results) {
        if(err) {
           console.error("Aggregation failed:", err);
           return;
        }
    
        console.log("result:", results)
     });

Disclaimers

  • Full text search and where expressions probably don't work. See third_party/mdb_conduit/README.md for more details.
  • It is only going to build on `nix platforms for now. "Linux" is whitelisted and OS X should be easy to make work when that becomes a priority (soonish).

Build Requirements

  • A bash compatible shell
  • Git
  • Python
  • A C++11 capable compiler.

Development Build Steps

  • Clone the module and cd into that directory.
  • Setup a nodeenv. You can skip this if you want to install globally, etc...
    pip install nodeenv
    nodeenv nodeenv
    . nodeenv/bin/activate
  • Install these globally for convenience.
    npm install -g node-gyp mocha
  • Build and test the module. The build will take ~5-6 minutes on a slower box. Note: npm install runs bin/clean.py afterwards, removing all temporary build artifacts which you do not want if you are going to do development on the module.
    node-gyp --debug configure build && npm test
  • Debugging.
    gdb --args node your_pipeline_test.js
    Once inside gdb, do:
    set auto-solib-add
    b init
    r

Troubleshooting

If you get a 'Error: Failed global initialization: BadValue default' error right after Module.load this most likely means that a function wasn't linked in that was needed (because I'm playing games). Build the module in debug mode (node-gyp --debug configure build) and set a breakpoint in build/Debug/obj.target/mongo/base/initializer_dependency_graph.cpp on line 113. Then look currentNode.first and currentNode.second to see what initializer function is missing from the the mdb-conduit shared library.