How to query collections from custom plugin in strapi?

In the backend of your plugin you can use the global strapi.contentTypes variable to fetch all Single and Collection types.