I am using sails-mongo adapter for my sails project.
I want to retrieve selected column from collection.
Here is my collection document data
{
"_id": ObjectId("54449e2ecaf08cf40fc8704f"),
"name": "demo",
"display_name": "demo",
…
I want my data sort by "createdAt" column . Sometime in ascending order and also descending order also. I am using mongo db .
Currently, I have created app which have feature like Users data can be sorted by admin request. Admin can view data in…
I'm trying to obtain all objects that have an especific object in a collection.
Example:
Object Company has a collection of Employees, and I want to find all Companies who have a especific Employee on this collection. What I'm trying to do…
I am a newbie in sails.js framework(and for node.js) and I have created myself an API from the address bar using sails.js features. my question is how do I transfer this data to mongodb so I can see it visually.
I have tried to follow this guide:…
I have a simple need to add tags to patients. I followed the Sails and Waterline documentation concerning many-to-many associations, but it's failing at some point (no errors). I'm using MongoDB for data storage. Code below:
Tag Model
module.exports…
I have two collections in mongodb database and model for each of them
App Model
module.exports = {
tableName: 'app',
attributes: {
_id : {
primaryKey: true,
unique: true,
type: 'string',
…
I use sails-mongo for working with models, I have a few attr with unique: true, but recently, this option does not work in the bug tracker said that it is necessary to add yourself this unique option, and then run using the migrate: safe. But I do…
I would like to be able to track the mutated (modified) attributes of an object in sails during afterUpdate lifecycle callback.
Assuming an object is updated I would like to know which attribute has been modified during the update operation, I've…
In my app, I have two models Person and Room. I also have two controllers, PersonController and RoomController. I have added no custom routes, and I've overridden none of the boilerplate controller actions.
When I POST to, for example,…
What I've understood, sails binds collection with its Models. Is there a way i can create a collection on runtime. What i want to do is create a different collection for each user. something like (user_12345, unique for every user).
I've tried…
When I try to run something as simple as this, I get an error: 'static() root path required'.
If only one 'it' is run, it will pass.
Anyone knows what's the catch?
var Sails = require('sails');
describe("Crud tests:", function() {
var app;
…
I'm trying to send to the view, information from multiple models as follows:
var tareasGlob = "";
var directoresProy = "";
var usuariosGlob = "";
var proyectosGlob = "";
module.exports = {
'index' : function(req, res, next){
// De esta…
I'm new in node js. I'm using sails js as framework. I'm trying to use nested database query.
Please check the added code.
My current mongo collection name is todostatus. Form it i grabbed the data . Then I tried to use a callback function to…
I'm using sails-mongo in my project and i need to execute one query in an embedded collection.
My data are something like the following:
{
"_id" : ObjectId("53906c6254f36df504e99b8f"),
"title" : "my post"
"comments" : [
{
…