I seek something of this nature
//validation rules in model "User"
attributes: {
age: {
required: true,
type: 'numeric'
}
},
//now in controller, i want to be able to do this
Recipe.validate({age: 'An invalid age because…
sailsjs: I am trying to define a model. I would like to add a property vendorID. The type would be the monogdb objectID from the vendor collection.
Something like for a store model:
module.exports ={
attributes :{
vendorId : { type:
Does anyone know if it's possible to populate a list of IDs for another model using waterline associations? I was trying to get the many-to-many association working but I don't think it applies here since one side of the relationship doesn't know…
I upgraded my sails from rc4 to rc7 today, and the unique constraint on my model stopped working. note that in rc4 it used to work perfectly. and sails-mongo version on both versions i tried is: "sails-mongo": "^0.10.0-rc5"
Model attribute:
…
I am currently working on an application using Sails version 0.9.9 but I want to upgrade to utilize the new support for data model associations. I found this article about migrating applications from 0.8.x to 0.9.x but is there anything I should do…
I have a sails app using sails-mongo and mongo db ... in the Database schema I originally named on of the fields 'name', I've since named the same key in other data types 'deviceName'. I would like to rename all of the records so that the field is…
I want to retrieve based on their list of IDs given. There is a list of ids I used inside my controller I want to retrieve all the objects array based on the given list of ids to me here is a prototype of my database record how it looks like
[
{
…
I created a WebApp with sails new my-app and am trying to use mongodb as its database. I am running mongodb in docker and am able to connect to the database using GUI tools like MongoDB Compass. Using that tool I created todo_list database in…
I was trying with the below configs :
In datastores.js I tried
adapter: 'sails-mongo',
url: 'mongodb+srv://xyz@cluster0.uaxyh.mongodb.net/xyz?retryWrites=true&w=majority',
ssl: true
The above URL is for MongoDB Atlas
In model.js
id: { type:…
I am working on Sails.js CRUD application (article management) with MongoDB based on @bradtraversy tutorial. I have encountered issue while trying to display articles from the database using EJS syntax and forEach loop. Error says "articles data is…
I want to migrate the schema of my models. I wanted to try to do so with the "migrate: alter" command in my env file.
The problem seems to be that on default the startup script will run in production mode which automatically uses "migrate:…
I add the userRecord to the database in the before function but when I try to authenticate using supertest it gives me bad combo.
I am using sails for the backend, the code is as follows
var request = require('supertest');
let should =…
I want to get the equivalent of db.serverStatus() command in mongo shell for Sails v0.12. In v1.0 I think they have sails.getDatastore for this. I searched the documentation for v0.12 and could not get an alternative. Is it possible to check the…