1.0.1 • Published 5 years ago

aggregation-query v1.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

input config

// options:
// {
//     caseSensitive: false;
//     searchFields: ["",""];
//     searchText: "";  #String
//     match: {};       
//     sort: null;      # {createdBy: -1}
//     limit: null;     # Numeric 
//     skip: null;      # Numeric 
//     project: null;   # {"test" : 1}
// }

output will be

[ { '$match': { '$or': [{test:{ '$regex': 'test' }, '$option': 'i'}] } },
      { '$sort': { createdBy: -1 } },
      { '$skip': 0 },
      { '$limit': 10 },
      { '$project': { test: 1 } } ]

aggregate query for mongo db

cont aggreateQuery = require('aggregare-query');

npm test