Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
feathers-query-filters
Advanced tools
Adds support for special query string params used for filtering data
Adds support for special query string params used for filtering data FeatherJS
npm install feathers-query-filters --save
This is used internally in service adapters like Feathers MongoDB and Feathers NeDB.
Usage is like so:
var Proto = require('uberproto');
var filter = require('feathers-query-filters');
var CustomService = Proto.extend({
init: function(name, options){
// your custom initialization code
},
find: function(params, callback) {
// Start with finding all, and limit when necessary.
var query = this.db.find({});
// Prepare the special query params.
if (params.query) {
var filters = filter(params.query);
// $select uses a specific find syntax, so it has to come first.
if (filters.$select) {
query = this.db.find(params.query, filters.$select);
} else {
query = this.db.find(params.query);
}
// Handle $sort
if (filters.$sort){
query.sort(filters.$sort);
}
// Handle $limit
if (filters.$limit){
query.limit(filters.$limit);
}
// Handle $skip
if (filters.$skip){
query.skip(filters.$skip);
}
}
// Execute the query
query.exec(function(err, docs) {
if (err) {
return callback(err);
}
return callback(err, docs);
});
},
setup: function(app) {
// Called by feathers.configure()
this.app = app;
this.service = app.service.bind(app);
}
});
module.exports = CustomService;
The following keywords are supported. They are pulled from the query object's conditions and returned so they can be mapped by each adapter in their own way.
v1.5.0 (2016-01-08)
FAQs
Adds support for special query string params used for filtering data
The npm package feathers-query-filters receives a total of 657 weekly downloads. As such, feathers-query-filters popularity was classified as not popular.
We found that feathers-query-filters demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.