1.1.5 • Published 10 years ago

breeze-mongoose v1.1.5

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

breeze-mongoose

BreezeJS server-side module that deals with mongoose models

Install

npm install breeze-mongoose

Usage

  1. Create a function that returns a mongoose model

    var mongoose = require('mongoose'),
        
       dbConnection = mongoose.createConnection(mongodb_connection_string),
        
       modelContainer = function getModel(model){ // the name of the model
         return dbConnection .model(model);
       },
    
       dbSchemas = dbConnection.models;
  2. Add the getMetadata endpoint to your API

    var breezeMongoose = require('breeze-mongoose')(modelContainer);
    
    app.get('breeze/metadata', function(req, res){
         res.json(breezeMongoose.getMetadata(dbSchemas ));
    })
  1. Add the saveChanges endpoint

    app.post(function(req, res){
            breezeMongoose.saveChanges(req.body)
                .then(function(saveResults){
                 res.json(saveResults);
            })
            .catch(function(message){
                res.send(500, message);
            });
        });

Example

https://github.com/ppoliani/breeze-mongoose-example

1.1.5

10 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago