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

ndx-mongo

v0.3.19

Published

Mongo database connector for ndx-framework apps

Downloads

10

Readme

ndx-mongo

mongo database connector for ndx-framework apps

Usage

npm install --save ndx-mongo

src/server/app.coffee

require 'ndx-server
  dbEngine: require 'ndx-mongo'
  mongoUrl: 'mongodb://192.168.99.100:27017/test'
  tables: ['users', 'table1', 'table2']
.start()

Environment variables

mongoUrl can be set with the environment variable MONGO_URL

Methods

db.select(string table, object whereObj, function callback)

Select data

db.insert(string table, object insertObj, function callback)

Insert data

db.update(string table, object updateObj, object whereObj, function callback)

Update data

db.upsert(string table, object upsertObj, object whereObj, function callback)

Upsert data

db.delete(string table, object whereObj, function callback)

Delete data

db.exec(string sql, array props, bool notCritical) -> data

Callbacks

ndx.database.on 'callbackName', (args, cb) ->
  #do something with args
  cb true #or false if you want to cancel the operation

ready

The database is ready to use

preInsert

  • args.table The database table being operated on
  • args.obj The object being inserted into the database
  • args.user The user carrying out the operation

cb(false) to cancel the insert

insert

  • args.id The inserted object's id
  • args.table The database table being operated on
  • args.obj The object that was inserted into the database
  • args.user The user carrying out the operation

preUpdate

  • args.id The id of the object being updated
  • args.table The database table being operated on
  • args.where The database query
  • args.obj The data to update
  • args.oldObj The value of the object preUpdate
  • args.changes The changes to be applied
  • args.user The user carrying out the operation

cb(false) to cancel the update

update

  • args.id The id of the object that was updated
  • args.table The database table that was operated on
  • args.obj The data that was updated
  • args.oldObj The value of the object pre update
  • args.newObj The value of the object post update
  • args.changes The changes that were applied
  • args.user The user carrying out the operation

preSelect

  • args.table The database table being operated on
  • args.args The arguments that were passed to the select function
  • args.user The user carrying out the operation

cb(false) to cancel the select

select

  • args.table The database table being operated on
  • args.objs The objects that were selected from the database
  • args.user The user carrying out the operation

preDelete

  • args.table The database table being operated on
  • args.where The database query
  • args.user The user carrying out the operation

cb(false) to cancel the delete

delete

  • args.table The database table being operated on
  • args.user The user carrying out the operation

callbacks can be used to modify data flowing to and from the database.
see ndx-permissions and ndx-profiler for examles

db.off(string callbackName, function callback) -> db

Unregister a callback