{ 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 in ORM & Database

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

Waterline ORM – To use or not to use

We are a fan of sail.js but one thing which remained a mystery to us was whether to use the sails.js waterline ORM and not. During our development phase, we had encountered various problems such as processing latency, poor performance etc as our database grew. We analyzed the performance of . . . 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" }

SailsJS – Log Queries

SailsJs provides a feature to Log queries in console. To log queries, use the below command to start your sails application LOG_QUERIES=true sails lift   Setting LOG_QUERIES env while starting sails, will start logging queries with other sails logs. Note: It will not log MongoDB Queries

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