Questions tagged [sails-mongo]

MongoDB adapter for Sails.js

Sails-mongo allows connecting to from using the ORM api.

400 questions
2
votes
1 answer

How to perform Model Joins + Condition on Relations in Sails.js?

How can I make a model join query(condition) and sort on relation models on Sails? Example: I have 4 tables(collections in mongodb) and 4 related models in mongodb: User: user_id, name Follow: user_id, following_id (user id is being…
Tín Phạm
  • 642
  • 1
  • 6
  • 16
2
votes
0 answers

SailsJs: how to use find for array of object attribute?

i have a model that it has some json type attribute and now I want to use find on this json attribute. may please help how can i do it? model: module.exports = { attributes: { ownerInfo: { type: 'json', description: 'owner info…
Me Sa
  • 1,036
  • 12
  • 14
2
votes
2 answers

MongoDB query using WHERE and IN clause

I need to fetch data from mongodb similer to the below sql query: select * from ar_pages where (slug='ettarc' or id in ('1','2','3','4')) Which uses one search condition and another with IN clause (fetch pages with specified slug and pages with…
ReNiSh AR
  • 2,782
  • 2
  • 30
  • 42
2
votes
2 answers

How to fix AdapterError: Unexpected error from database adapter: object [{"_bsontype":"ObjectID","id":null}]

I need to add ObjectId in nested collection in MongoDB, and i just upgrade my sails version, now when I'm going to update my collection and there is nested object have object id it's giving me below error AdapterError: Unexpected error from…
2
votes
1 answer

Unable to get the id of newly created record sails js

I am creating a new record like this: Resource.create({ title: req.body.title, address: {...req.body.address}, email: req.body.email, }, (err, record) =>{ if(err){ res.send({'status': err}); }else{ res.send( …
Kevin Hernandez
  • 1,270
  • 2
  • 19
  • 41
2
votes
0 answers

How to fix 'When using `sails-mongo`, primary keys MUST have `columnName: '_id'`'

I'm using: "sails": "1.2.1", "sails-mongo": "1.0.1" when i get documents of a mongodb collection, i've got error like this: In model `archive`: debug: The default primary key attribute (`id`) is not set up correctly. debug: When using…
Homayoon
  • 31
  • 5
2
votes
1 answer

TypeError: exits.success is not a function

I´m trying to figure out how to use Sails.js with the node-machine-syntax. This is the list action of my flights, simple, nothing crazy. I´m trying this: /** * FlightsController * * @description :: Server-side actions for handling incoming…
2
votes
1 answer

sails.js remove all members from collection waterline

I want to remove all members that a collection has , but I do not want to pass every member ID to .member() method . waterline documentation explain a way to delete specific members like : await User.removeFromCollection(3,…
SayJeyHi
  • 1,559
  • 4
  • 19
  • 39
2
votes
1 answer

Sails.js "Could not tear down ORM hook" error with sails-mongo

I recently updated Sails from 0.12 to 1.0.2 on my laptop and started a new project. I'm trying to connect to a MongoDB database using sails-mongo but I get the following error: my-app_1 | error: A hook (`orm`) failed to load! my-app_1 | error:…
JackH
  • 4,613
  • 4
  • 36
  • 61
2
votes
1 answer

Can we use of Nested where clause in sails js Collection

I am trying below queries to get the output which has start_date greater than current date. These in structure of my collection: { "_id" : ObjectId("5aeac6cd1b7e6f252832ca0e"), "recruiter_id" : null, "university_id" : null, …
Chetan
  • 21
  • 2
2
votes
2 answers

Sails.js upgrade to v1 reverse case sensitive queries

After upgrading to sails v1 all the requests in the controllers became case sensitive. Although this is expected, commented here: https://sailsjs.com/documentation/concepts/models-and-orm/models#?case-sensitivity, I would like to have case…
agonza1
  • 439
  • 7
  • 20
2
votes
0 answers

Sails-Mongoose ORM override hook shuts down the server automatically

I am building an App on SailsJS and am using MongoDb using sails-mongoose hook. The server automatically crashes and shuts down mentioning the error shown below. I observe that it mainly happens when my computer goes in sleep mode. I am not sure if…
Masade
  • 715
  • 1
  • 11
  • 29
2
votes
1 answer

Migrating over 3mill of data to MongoDB

I am trying to move mysql data to MongoDB. The record is over 3million rows. And every time it runs out of memory even after modifying my node start script "scripts": { "debug": "node debug app.js", "start": "node --max_old_space_size=5120…
Tonespy
  • 3,257
  • 7
  • 26
  • 52
2
votes
1 answer

Sailjs with sails-mongo is enforcing type incorrectly. What am I doing wrong?

I have a sails app working with just a simple index and simple create (insert) to a mongo db. When I enter correctly typed data hard coded to be the type stated in the model, I get an error. url insert err = [Error (E_VALIDATION) 1 attribute is…
DFBerry
  • 1,818
  • 1
  • 19
  • 37
2
votes
2 answers

Waiting for asynchronous task to complete nodejs

I am creating an application where a user can have many rooms and each room can have many channels, here is my code when retrieving the rooms and corresponding channels: getRooms: function (req, res) { User.find({id:…
Acheme Paul
  • 1,194
  • 15
  • 19