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

mongous

v0.2.7

Published

Simple MongoDB driver

Downloads

46

Readme

Mongous

Mongous, for humongous, is a simple and blazing fast MongoDB driver that uses a jQuery like syntax.

How it works

var $ = require("mongous").Mongous;

$("database.collection").save({my:"value"});

$("database.collection").find({},function(r){
	console.log(r);
});

Done. App development has never felt as close to the shell as this! Making it a breeze to grab'n'store anything anywhere in your code without the nasty hassle of connections, collections, and cascading callbacks.

Database & Collections

  • db('Database.Collection')
    • Database is the name of your database
    • Collection is the name of your collection
    • Examples
      • db('blog.post')
      • db('blog.post.body')

Commands

  • Update db('blog.post').update(find, update, ...)
    • find is the object you want to find.
    • update is what you want to update find with.
    • ...
      • { upsert: true, multi: false }
      • true, true
  • Save db('blog.post').save(what)
    • what is the object to be updated or created.
  • Insert db('blog.post').insert(what...)
    • what is an object to be created. is an array of objects to be created.
    • Examples
      • db('blog.post').save({hello: 'world'})
      • db('blog.post').save([{hello: 'world'}, {foo: 'bar'}])
      • db('blog.post').save({hello: 'world'}, {foo: 'bar'})
  • Remove db('blog.post').remove(what, ...)
    • what is the object to be removed.
    • ... true for atomic.
  • Find db('blog.users').find(..., function(reply){ })
    • reply is the reply from MongoDB.
    • reply.documents are the documents that you found from MongoDB.
    • ... params are filtered by type
      • Objects
        • first object is what you want to find.
        • second object are fields you want Ex: { name: 1, age: 1 }
        • third object is any of the following options: { lim: x, skip: y, sort:{age: 1} }
      • Numbers
        • first number is the limit (return all if not specified)
        • second number is the skip
    • Examples
      • db('blog.users').find(5, function(reply){ }) reply.documents is the first 5 documents,
      • db('blog.users').find(5, {age: 23}, function(reply){ }) with age of 23,
      • db('blog.users').find({age: 27}, 5, {name: 1}, function(reply){ }) and a name.
      • db('blog.users').find(5, {age: 27}, {name: 1}, {lim: 10}, function(reply){ }) is the same as the previous example, except the limit is 10 instead of 5.
      • db('blog.users').find(5, function(reply){ }, 2) reply.documents skips the first 2 documents and is the next 3 documents.
      • db('blog.users').find(function(reply){ }, {age: 25}, {}, {limit: 5, skip: 2}) is the same as the previous example except only of doucments with the age of 25.
      • db('blog.users').find({}, {}, {sort: {age: -1}}, function(reply){ }) reply.documents is sorted by age in a decsending (acsending while it is {age:1} ) order.
  • Operations db('blog.$cmd').find(command,1)
    • command is the database operation command you want to perform.
    • Example db('blog.$cmd').find({drop:"users"},1) drops the users collection, deleting it.
  • Authentication db('blog.$cmd').auth(username,password,callback)
    • username, password username and password of the 'blog' database
    • callback the callback function when authentication is finished.
    • Example
      • db('blog.$cmd').auth('user','pass',function(reply){})
  • Open db().open(host,port)
    • Only necessary to call if you explicitly want a different host and port, elsewise it lazy opens.

Mongous is a reduction ('less is more') of node-mongodb-driver by Christian Kvalheim.