symfio-contrib-mongoose

Mongoose plugin for Symfio.

symfio-contrib-mongoose

Connect to MongoDB database using mongoose module.

symfio = require "symfio"
 
container = symfio "example"__dirname
 
loader = container.get "loader"
 
loader.use require "symfio-contrib-mongoose"
 
loader.use (container, callback) ->
  connection = container.get "connection"
  mongoose = container.get "mongoose"
 
  NewsSchema = new mongoose.Schema
    title: String
 
  News = connection.model "news"NewsSchema
 
  callback()
 
loader.load()
  • connection — Mongoose connection instance.
  • mongoosemongoose module.
  • mongodbmongodb module.
  • connection string - Default value received from process.env.MONGOHQ_URL. If process.env.MONGOHQ_URL is undefined then default value is "mongodb://localhost/#{name}".