{ sailsit }

Sails Js Tutorials for Beginners and Forum

Have a Question?

If you have any question you can ask below or enter what you are looking for!

All posts tagged sails-mongo

Raw Native Queries

1. Creating SailsJs Project Follow the below tutorial for setting up SailsJs Setting up sails project 2. Database Setup You can follow the below tutorial about setting up MySQL & MongoDb Setting up MySQL & MongoDB in SailsJs 3. Creating Models Use the below command to generate People model sails . . . Read more

Sails – Mongo ReplicaSet Configuration

In SailsJs, to configure replica set for MongoDB You can use MongoURI directly with all the details in your connnections.js file Below is the MongoURI format "mongodb://{replicaSet1}:{port},{replicaSet2}:{port},{replicaSetN}:{port}/{dbName}?replSet={replicaSetName}&readPreference=nearest&slaveOk=true"   The above URI then can be used in Sails config/connections.js as below mongoDB: { adapter: "sails-mongo", url: "mongodb://{replicaSet1}:{port},{replicaSet2}:{port},{replicaSetN}:{port}/{dbName}?replSet={replicaSetName}&readPreference=nearest&slaveOk=true" }

MongoDB and MySQL Configuration

1. Create new project You can follow this tutorial for setting up sails project Setting up Sails project 2. Installing Packages To use MySQL/MongoDB, first you need to install adapter for it Install sails-mongo adapter using npm. npm install sails-mongo –save   Install sails-mysql adapter using npm npm install sails-mysql . . . Read more

Simple CRUD Operations – REST API

1. Setting up SailsJS Environment First you need to setup Sails project. You can follow the guide on Sails official website Getting Started with SailsJS 2. Creating Project Run this command in any directory sails create sails-crud-simple This command will create new project with all the required dependencies 3. Setting . . . Read more