Skip to content

rist/mongodbstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a backend for the RingoJS Storable interface based on MongoDB1.

THIS CODE HASN'T BEEN UPDATED IN 3 YEARS AND IS PROBABLY NOT COMPATIBLE ANY MORE WHITH CURRENT VERSIONS OF RINGOJS

Requirements

It is written against version 1.4.3 of MongoDB.

Notes

This code is heavily inspired (read copy&paste) by the googlestore storage layer of RingoJS.

Functionality

Initializing the store:

include('ringo/storage/mongodbstore');
store = new Store('server', 27017, 'dbName');

Creating a new Storable class:

Book = store.defineEntity('book');

Creating and saving a new Storable instance:

var b = new Book({title: "DBs for dummies"});
b.save();

Retrieving all objects from a db:

var books = Book.all();

Retrieving an object by id:

var book = Book.get(id);

Deleting an object from the db:

book.remove();

Running a query on the database:

Book.query().equals('prop', value).select();

The Query.select() method takes an optional argument to retrieve just a property rather than the whole object, e.g. '_id' or 'title'.

About

A MongoDB Ringo storage backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published