<commit_before>Moonridge    [![Build Status](https://travis-ci.org/capaj/Moonridge.svg?tag=1.0.3)](https://travis-ci.org/capaj/Moonridge) [![Dependency Status](https://david-dm.org/capaj/Moonridge.svg)](https://david-dm.org/capaj/Moonridge)
=========
[![NPM badge](https://nodei.co/npm/moonridge.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/moonridge/)



Allows to call Mongoose remotely through socket.io-rpc. Usable in browser with any framework-let it be Angular, Aurelia, React or any other.
It is also isomorphic, so your client can be another node.js process(nice for midway testing).
Offers killer feature(live queries) from Meteor.js for your frontend in a framework agnostic fashion. How?
See examples in smoke test folder([Angular](test/e2e-smoketest/angular)|[Aurelia](test/e2e-smoketest/aurelia)), if still not sufficent, read source code. Better docs are planned/WIP.

#Prerequisities

Moonridge is written in commonJS format(client works in node and browser without much hassle), so you need globally installed [jspm](https://github.com/jspm/jspm-cli) to be able to install it and run it.
If you don't have jspm, install it with this command:

    npm i jspm -g

Also currently it requires to have socket.io-rpc installed too. This I will get rid of.

##Basic usage serverside
```javascript
    var mongoose = require('mongoose');
    var Moonridge = require('moonridge');
    var MR = moonridge(mongoose, "mongodb://localhost/moonridge_showcase");		//MongoDB address is optional-you can connect as always with mongoose

    var bookModel = MR.model('book', {  //mongoose schema defintion
            name: String,
            author: String
        }, {
             schemaInit: function (schema) {
                // makes sure only one book per nameXauthor exists<commit_msg>better description under main title<commit_after>Moonridge    [![Build Status](https://travis-ci.org/capaj/Moonridge.svg?tag=1.0.3)](https://travis-ci.org/capaj/Moonridge) [![Dependency Status](https://david-dm.org/capaj/Moonridge.svg)](https://david-dm.org/capaj/Moonridge)
=========
[![NPM badge](https://nodei.co/npm/moonridge.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/moonridge/)



isomorphic library, which brings Mongoose mongoose model to the browser(or over the network to other node process). Based on [socket.io-rpc](https://github.com/capaj/socket.io-rpc). Framework agnostic-usable with any framework-let it be Angular, Aurelia, React or any other.


Offers killer feature(live queries) from Meteor.js. How?
See examples in smoke test folder([Angular](test/e2e-smoketest/angular)|[Aurelia](test/e2e-smoketest/aurelia)), if still not sufficent, read source code. Better docs are planned/WIP.

#Prerequisities

Moonridge is written in commonJS format(client works in node and browser without much hassle), so you need globally installed [jspm](https://github.com/jspm/jspm-cli) to be able to install it and run it.
If you don't have jspm, install it with this command:

    npm i jspm -g

Also currently it requires to have socket.io-rpc installed too. This I will get rid of.

##Basic usage serverside
```javascript
    var mongoose = require('mongoose');
    var Moonridge = require('moonridge');
    var MR = moonridge(mongoose, "mongodb://localhost/moonridge_showcase");		//MongoDB address is optional-you can connect as always with mongoose

    var bookModel = MR.model('book', {  //mongoose schema defintion
            name: String,
            author: String
        }, {
             schemaInit: function (schema) {
                // makes sure only one book per nameXauthor exists
{'fraction_non_alphanumeric': 0.11722815666940564, 'fraction_numerical': 0.002738975623116954, 'mean_word_length': 3.9958960328317374, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 15, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '152416', 'n_tokens_mistral': 1150, 'n_tokens_neox': 1112, 'n_words': 350}