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:…
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
},
…
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,
…
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…
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…
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:…
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…
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…
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…
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…
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…
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.
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…
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…
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…