jupe/mongoose-query — pull request #1 by unbornchikken (2014-04-28 11:51:48+00:00)
Title: Ignore key + lean query support.

Hello,

My name is Gabor, and I want to contribute my ideas to library of yours. I'm from a .NET background, and I'm still a huge fan of the OData protocol. I think your project eventually will catch it regarding the query possibilities in a way that fits best in the MongoDb world.

I have a small pull request right now. Two issues addressed:

- If you use Passport LocalApiKey module, then you have to send "apikey" parameter in the query string. But the current implementation will add this to the query. I added support for handling the mongoose plugin options object, so on schema plugin definition it is possible to ignore query keys, for ex:

contentSchema.plugin(QueryPlugin, { ignoreKeys: "apikey" }); // will ignore ?...&apikey=blahblah
contentSchema.plugin(QueryPlugin, { ignoreKeys: true }); // will ignore all query keys which is not q,t,f,s,etc

- When someone use mongoose-query there won't be serverside operations on the result often. Istead the result will be pushed toward the clients immediately. So for performance reasons there should be no mongoose magic, just plain old json objects. For this purpose I've added an other plugn operation, leanQuery.

p.s.: I'm thinking other query methods, like defineQuery which is not executes the query just definie it. This way we can easily intergate mongoose-query with mongoose-q.