These are chat archives for Automattic/mongoose

Oct 2018
Oct 21 2018 02:03
Oct 21 2018 14:12


How can I create a custom validator that checks that a given array field on the schema should not be empty?

in your code sample above, you've defined the validator on the array element instead of the array itself.
Here's an example gist of defining it on the array instead

Hi @CandleCoder !
Oct 21 2018 16:47
@lineus Thank you! That fixed it!
Oct 21 2018 20:53
Hello here! Does someone know how I can create the endpoint to accept valid mongodb query operations or filters? So I would like the user of my api to be able to send something like { _id: { $in: [<value1>, <value2>, ... <valueN> ] } } as a filter or any other valid mongodb query and projection operators!
So the uri for the endpoint would look like: http://localhost:3000/api/silc_groups?_id:$in:[abcd1,ababa2,ababab3] but I am getting something that needs much more processing on the server. Any tips?