Questions tagged [sails-mongo]

MongoDB adapter for Sails.js

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

400 questions
4
votes
1 answer

Sails.js $near query does not work and asks for indices

I'm trying to query the nearest points to some coordinate in Sails.js using MongoDB, but I'm getting the following error: { [MongoError: can't find any special indices: 2d (needs index), 2dsphere (needs index), for: { $near: { $geometry: { type:…
Loolooii
  • 8,588
  • 14
  • 66
  • 90
4
votes
0 answers

Sails.js model unique property doesn't work in production env

I am fairly new to sails and have followed a simple tutorial to create a REST api. I have created a model: module.exports = { schema: true, attributes: { name: { type: "string", unique: true, required: true }, …
alexjfno1
  • 337
  • 1
  • 3
  • 14
4
votes
1 answer

How to filter a query based on collection from many-to-many

I have two model objects. Doctors and Hospitals. The model definitions look like: module.exports = { schema: true, autoUpdatedAt: true, autoCreatedAt: true, attributes: { name: { type: 'string', required: true, …
Jim Geurts
  • 20,189
  • 23
  • 95
  • 116
4
votes
2 answers

One to many association on Sails 0.10.x fails to retrieve owner data using populate

I'm trying to create a simple one-to-many assocation using sails 0.10.x with mongoDB. I have two models, Game and Map, which a game can have multiple maps associated to its account. Using populate I can correctly get all the maps associated to the…
catastrophic error
  • 380
  • 1
  • 5
  • 18
4
votes
2 answers

Distinct in sails js and mongodb

Model.distinct("Age").done(function(err, ward) { if(err) return next(err); if(!ward) return next(); res.json(ward); }); After executing this code, it gives the following error: TypeError: Object [object Object] has no method…
user3736968
  • 85
  • 2
  • 5
3
votes
1 answer

Alternative to Sails Mongo Adapter to support MongoDB 5.0 & 6.0?

Any alternatives to sails-mongo adapter? According to Sails-Mongo Compatibility, sails-mongo only supports up to MongoDB 4.2. Current issue I face is the below: error: Sending 500 ("Server Error") response: MongoError: Unsupported OP_QUERY command:…
E. Oregel
  • 321
  • 2
  • 4
  • 15
3
votes
1 answer

Multiple field pass to get the query failed

I am trying to find the list of users based on the different queries. Like if I pass firstname or lastname or location I want data based on one of them or all of them but I've failed to get the details. And also there are 2 nested fields I want to…
Developer Nans
  • 311
  • 1
  • 4
  • 14
3
votes
1 answer

Sails 1 - Consistency violation: Attempting to tear down a datastore (`default`) which is not currently registered with this adapter

I'm getting the following error when lifting a sails 1 app: Consistency violation: Attempting to tear down a datastore (default) which is not currently registered with this adapter. This is usually due to a race condition in userland code…
Agustín
  • 1,546
  • 7
  • 22
  • 41
3
votes
1 answer

Create models dynamically in Sails.js

I am using mongo and sails.js. My application allows the user to create a new collection in the mongodb. Since this collection is being created by the user there is no sails model in the models folder therefore I cannot query the new collection…
mblais29
  • 349
  • 1
  • 2
  • 9
3
votes
1 answer

Maintaining history of model updates in SailsJS

What is an efficient approach to maintaining data history for models in Sails? For instance, how do we maintain the data if a user updates the database and we'd like to keep versions for reverting the data as it updates. I've seen numerous examples…
Grant B
  • 31
  • 1
3
votes
1 answer

Sails.js - blueprint query by if one-to-many asscoisation exists

I've asked a very similar question on SO in the past, but I'm struggling with this one. My previous question was regards one-to-one blueprint/waterline query, this however is one-to-many. I have a sails.js app using a Mongo DB. I have two…
dandanknight
  • 659
  • 5
  • 21
3
votes
1 answer

get records created within 24 hour in sails js

I want to fetch the Posts which are created within 24 hours in sails js. And I am using mongodb database. How do I get all those Posts which are created in past 24 hours.
Tejashri Bedarkar
  • 149
  • 1
  • 2
  • 10
3
votes
2 answers

sailsjs waterline search into two tables

sailsjs waterline combined search for name like '%sam%' from one table and product name like '%nike%' from another table and left join for getting data in terms of user. i know there is no left join in mongo but how to achieve this. i am using…
Ankur
  • 51
  • 4
3
votes
0 answers

sails crash: Maximum call stack size exceeded

I am having a problem scaling a sails application, once I get to around 4k entries in a collection, a GET on that collection will cause the database to crash. I am currently using a Mongo database, and the sails-mongo-adaptor. What is printed in the…
3
votes
2 answers

Construct a waterline model object from a javascript object

To ease load on my MongoDB server, I want to cache some objects from Waterline in Redis. To achieve this, I have to serialize the object to JSON. My question is, how can I construct my JSON back to an instance of the Waterline model, with datatype…
stensrud
  • 156
  • 5
1 2
3
26 27