Skip to content

Commit

Permalink
fix: remove project() from the doc
Browse files Browse the repository at this point in the history
  • Loading branch information
loicmathieu committed Sep 23, 2019
1 parent 4bd0d3b commit d561d4a
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions docs/src/main/asciidoc/mongodb-panache-guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,6 @@ sets you can use the `find` method equivalents, which return a `PanacheQuery` on
// create a query for all living persons
PanacheQuery<Person> livingPersons = Person.find("status", Status.Alive);
// specify a projection to limit the fields returned from the database
livingPersons.project("name", "birthdate");
// make it use pages of 25 entries at a time
livingPersons.page(Page.ofSize(25));
Expand Down Expand Up @@ -384,19 +381,6 @@ public class Person extends PanacheMongoEntity {
Both `findByNameWithPanacheQLQuery()` and `findByNameWithNativeQuery()` methods will return the same result but query written in PanacheQL
will use the entity field name: `name`, and native query will use the MongoDB field name: `lastname`.

== Query projection

Query projection can be done with the `project()` method on the `PanacheQuery` object that is returned by the `find()` method.
You can use it to restrict which fields will be returned by the database.
Note that the ID field of your entity (the one corresponding to the MongoDB `_id` field) will always be returned.

[source,java]
----
// only 'name' and 'id' fields will be returned
PanacheQuery<Person> query = Person.find("status ", Status.Alive).project("name");
PanacheQuery<Person> query = Person.find("{'status': ?1}", Status.Alive).project("name");
----

== The DAO/Repository option

Look, we get it: you have a love/hate relationship with DAOs/Repositories but you can't live without them. We don't judge, we know life is tough and we've got you covered.
Expand Down

0 comments on commit d561d4a

Please sign in to comment.