I'm developing an API with Sails, and now I need to securize some variables from an entity. Those variable will be accesed only from Admin or own user.
I have an structure like this:
Employee (contains your employee…
I have an array like this on under user collection
How can i remove a single value from this array by using sails.js code
also i need to remove all post id from every users document if a post is deleted, is there any simplest and fastest way to…
I want to broadcast a notification to all users in one of my services, notifications are array attribute of user model.
so I should push object of new notification to every user notification array in database.
here is my code:
broadcastNotif :…
So, when I upload file it doesn't me show any error, it just doesn't upload the file and I get the message '0 files uploaded successfully, I do get the record in database for each uploaded item
So, here's the input form
Ok, I've got the following in one of my controllers:
User.find({email: 'email@example.com'}).then(function (user) {
user[0].field = 'new_value';
user[0].field_2 = 'new_value';
console.log(user[0], 'before saving');
user[0].save();
…
We are using sails framework for our web application and MongoDB as database.
Now we are calling services of the web app from the mobile.
There can be around 200-300 concurrent users calling webservice.
I observed that there are around 5-6 services…
I'm trying to setup a sails hook with miniprofiler to help profile mongo usage. I'm struggling for how to wrap the db methods in a function that will execute the profile. I'm trying to do this via a user hook:
setupMiniprofilerMongo(req, res, next)…
According to the .native() documentation, the way to use .native() query for sails-mongo is :
Pet.native(function(err, collection) {
if (err) return res.serverError(err);
collection.find({}, {
name: true
}).toArray(function (err,…
hopefully someone can help me. I'm using sails and sails-mongo to connect to my Mongo DB replicaSet. This is all done via config in Sails, so I do not actually create the connection using the MongoDB driver myself, Sails and the ORM (Waterline) take…
I build a web app using sails.js and my database is mongo.
This is my model - Conversation:
module.exports = {
tableName: 'conversations',
attributes: {
members: {
type: 'array',
collection: 'user'
},
status: {
…
here is my code snippet. I am trying to get details of my friends.friendsList is in reside within the user collection itself and there i am inserting users's id. So first i am fetching userId,then fetching each of their details.but my problem is i…
here is my code snippet.
I am trying to get details of my friends.friendsList is in reside within the user collection itself and there i am inserting users's id. So first i am fetching userId,then fetching each of their details.but my problem is i…
I'm working on a project that is built on top of SailsJS but now i'm writing the Update process for a document and when i'm doing this, getting the following error.
{
"code": "E_VALIDATION",
"invalidAttributes": {
"deleted": [
…
I am new to sails js. I am using mongodb database. I have users collection. I have created api using sails generate api users it creates Users.js and UsersController.js files. I want to know that can we create another controller or model for the…