System Information
- Strapi Version: 3.4.0
 - Operating System:
 - Database: mongoDB
 - Node Version: 12.18
 - NPM Version:
 - Yarn Version:
 
How can I apply endsWith string filter on query?
I’m currently using mongoDB.
How can I apply endsWith string filter on query?
I’m currently using mongoDB.
You would need a custom query for that as we don’t have a built in filter for endsWith
https://strapi.io/documentation/developer-docs/latest/concepts/queries.html#mongoose
https://mongoosejs.com/docs/api.html#model_Model.find
And probably using a regex filter
Got it Thanks 
How did you implement your solution @darron1217? I find the “Custom Queries” part vague. There is no clear explanation on how we should implement custom filters.
Where should I put the new custom query? In a custom service?
Yes, I implemented it on custom service.
But I’m not sure this is the best way.
How do you extend the existing find method?
@baptisteArno in a normal API Model or one from a plugin’s model?
I created another route & controller & service for custom query. (All I need was just checking phone number, so I added new route for it)
I need to know how I can extend this method: strapi.query("restaurant").find(params, populate) or if I can’t extend it, I need its source code
https://strapi.io/documentation/developer-docs/latest/concepts/queries.html#custom-queries
There’s difference between SQL and noSQL.
SQL
const result = await strapi
  .query('restaurant')
  .model.query(qb => {
    qb.where('id', 1);
  })
  .fetch();
noSQL
const result = strapi.query('restaurant').model.find({
  date: { $gte: '2019-01-01T00.00.00Z' },
});
            Yes I completely understand!
I’m talking about strapi.query("restaurant").find(params, populate) not strapi.query("restaurant").model.find(params, populate) haha it’s confusing…
I need to find the declaration of strapi.query("restaurant").find(params, populate) so that I can copy/paste it and add my custom filter
Those are core-database queries that can’t really be extended without forking the related connectors: