For my API project, I have opted to use sailsjs as my framework. The documentation at provides a list of query modifiers that can be used.
User.find({
or: [
name: { startsWith: 'thelas' },
email: { startsWith: 'thelas' }
]
}, cb);
Using this information, I created the following modifier:
var query = {
or: [
cityName: {
contains: req.param('city')
},
zoneNumber: {
startsWith: req.param('query')
}
]
};
I then passed the query like this:
User.find(query, function(err, res){});
However, I encountered an error related to the format of the query:
cityName: {
^
SyntaxError: Unexpected token :
Could this error be due to breaking JSON format rules, or is it a less common issue originating from the framework itself?