Giter VIP home page Giter VIP logo

humblejs's Introduction

HumbleJS - MongoDB ODM for Javascript

HumbleJS is the sister project of HumbleDB, a MongoDB ORM for Python. HumbleJS tries to maintain API parity with HumbleDB where at all possible, and when it makes sense, extends the API for convenience and clarity in JavaScript and CoffeeScript.

HumbleJS is written in CoffeeScript, but compiled and distributed as JavaScript.

Build Status Dependencies

Currently HumbleJS is stable in core features, but under development as nice-to-have features are added regularly. Documentation is a work in progress.

Documentation is available on Read The Docs.

Quickstart

HumbleJS is available on npm.

Instaling HumbleJS...

$ npm install humblejs

And working with HumbleJS makes code clear, concise and readable...

var humblejs = require('humblejs');

// Create a new database instance
var my_db = new humblejs.Database('mongodb://localhost:27017/my_db');

// Use the document factory to declare a new Document subclass
var MyDoc = my_db.document('my_docs_collection', {
    doc_id: '_id',
    value: 'val',
    default: ['def', true],
    meta: humblejs.Embed('meta', {
        author: 'auth',
        created: 'created'
    })
});

// A document maps attribute names to document keys for clean, readable code
var doc = new MyDoc();
doc.doc_id = 'example';
doc.value = 1;
doc.meta.author = "Jimmy Page";
doc.meta.created = new Date();

// Documents have convenience methods for saving, inserting, and removing
doc.save(function (err) {
    console.log("Document saved:\n", doc);
    /*
    Document saved:
     { _id: 'example',
       val: 1,
       meta:
        { auth: 'Jimmy Page',
          created: Tue Nov 11 2014 13:11:05 GMT-0800 (PST) } }
    */
});

// Document classes have convenience methods for querying, updating, etc.
MyDoc.find({doc_id: 'example'}, function (err, docs) {
    if (err) throw err;
    // Do something with docs here, which will be an array
});

Changelog

See the releases for changes by version.

Contributors

License

MIT - See LICENSE

humblejs's People

Contributors

shakefu avatar nigelkibodeaux avatar carterbancroft avatar

Stargazers

Vinod S Pattar avatar David avatar

Watchers

Damian Janowski avatar  avatar asfman avatar  avatar Paul Nues avatar James Cloos avatar  avatar Josh Reichardt avatar David avatar Jordan Dodds avatar Summer Ordoñez avatar Antoine Meunier avatar An Vo avatar  avatar Eric Dong avatar Nick avatar  avatar Melissa Brown avatar Mattia M. avatar

Forkers

aszmyd shakefu

humblejs's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.