Reputation: 968
Can I create finder using roo with mongodb? It doesn't seem to support but I can't find anywhere says so.
I got the error/info : Command 'find list' was found but is not currently available (type 'help' then ENTER to learn about this command)
So the question is how can I create my own finder? all the example that I find on the net is for relational database and can't find one for mongodb.
many thanks.
Upvotes: 3
Views: 528
Reputation: 1682
You can find out how to create your own finders in the Query Methods section of the Spring Data MongoDB - Reference Documentation.
In Spring Roo with mongodb setup, your Repository interface already extends PagingAndSortingRepository.
If you have a model Person, with a property "lastName", you can declare a method findByLastname(String lastname) in your Repository interface. E.g.
@RooMongoRepository(domainType = Person.class)
public interface PersonRepository {
List<Person> findAll();
List<Person> findByLastname(String lastname);
}
For how to create other finders have a look at "Table 6.1. Supported keywords for query methods" in the link given above.
Upvotes: 1