vadimdemedes / mongorito

🍹 MongoDB ODM for Node.js apps based on Redux
1.38k stars 90 forks source link

Features/query exclude array issue #109

Closed SirbyAlive closed 8 years ago

SirbyAlive commented 8 years ago

When we give an array of fields to exclude to Query, we receive a MongoError:

MongoError: Projection cannot have a mix of inclusion and exclusion.

Indeed the key is first recognized as an Array, then an Object resulting in the query fields being set to:

{ '0': 'title', '1': 'published', title: 0, published: 0 }

Therefore I suggest to link the array and test object with an else if statement so object is not processed if the key has already been recognized as an Array.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+1.4%) to 95.413% when pulling de578156a77229c8a1c985578eb9f32076b32968 on SirbyAlive:features/query_exclude_array_issue into e6f05e7768bf6510da35ed635fd4a7c1b4b45602 on vdemedes:master.

vadimdemedes commented 8 years ago

Thank you! Sorry for the late response though.