sails-goose
v1.0.6
Published
Mongoose Integration for sailsjs
Downloads
3
Maintainers
Readme
https://github.com/carlosmtx/sails-goose
npm install sails-goose
Create a file named "goose.js" in the config folder with this content :
module.exports.goose = { myDb : { globals : true , host : "localhost", port : 27017, db : "test", options : { // db : "", // server : "", // replset : "", // user : "", // pass : "", // auth : "", } }
}
Create the folder "goose-schemas" in the api folder
Add all your schemas in the goose-schema folder using the following structure :
//File User.js
module.exports = {
name : String, email : String, birthday : Date, about : String, interest : require("Interest.js"),
};
Add " require('sails-goose')("myDb"); " to "app.js"
If you have set globals to true you can use mongoose models like this:
User.find({name : 'teste' });
Alternatively you can use :
goose.User
For a list of all the schema 'options' check : http://mongoosejs.com/docs/connections.html#options