Socket
Socket
Sign inDemoInstall

breeze-mongoose

Package Overview
Dependencies
3
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    breeze-mongoose

BreezeJS server-side module that deals with mongoose models


Version published
Weekly downloads
15
Maintainers
1
Install size
1.44 MB
Created
Weekly downloads
 

Readme

Source

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 ));
    })
    
  3. 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

Keywords

FAQs

Last updated on 08 Jan 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc