With MongoDB with Panache you can write queries in two styles:
- PanacheQL, which is a subset of JPQL (the query language of JPA), a query language very close to the WHERE clause of an SQL query.
- Native MongoDB query, for convenience JSON can be written with single quote instead of double quote.
The easiest is of course PanacheQL, while using native MongoDB query you can embrace the full power of MongoDB query language (but you'll need to write JSON query).
If you are using PanacheQL, you can check the generated query by setting DEBUG log level to the logger io.quarkus.mongodb.panache.runtime
as explained in the Query debugging of the guide.
On the guide, there is some examples of PanacheQL queries, if you feel that more should be added please open an enhanement request with some example you would want to be added (or even a PR !).
To answer your questions regarding the queries
Can I use a Collection on status in ?1?
Yes, this is supported.
How to debug queries?
You can enable query logging, and play the same query directly on MongoDB (using the mongo shell or any MongoDB UI).
Can someone please provide examples for the usual operators like AND, OR, IN, EQUALS, GREATER THAN,...?
There is examples on the Simplified queries section and we provide the list of operators supported, among us AND, OR (but you can't mix both), IN, = , >=, <=, ... There isn't an example for all of them but you can find plenty example of SQL WHERE clause with them.
Here are a few sample (not tested)
People.list("name = ?1 and country = ?2", "Doe", "France");
People.list("name = ?1 or country = ?2", "Doe", "France");
People.list("age >= ?1 or cage <= ?2", 10, 60);
People.list("country in ?1", List.of("France", "Germany"));
How to index fields out of the code
If you talk about automatic MongoDB index creation, it's not supported. There is however enhancement request to support it, or to more generally support MongoDB database migration.