1

I wonder if it is possible to find an object list by any field. Something like below?

public interface MyRepo extends MongoRepository<MyObject,String>{
    List<MyObject> findByAnyField(String query);
}
N00b Pr0grammer
  • 4,243
  • 5
  • 30
  • 43
Ismail Sahin
  • 2,550
  • 5
  • 27
  • 57

1 Answers1

2

This feature is not supported by Spring Data MongoDB. Derived repository query methods support either regular or geo queries.

You can implement find-by-any field yourself, see Searching for value of any field in MongoDB without explicitly naming it

Community
  • 1
  • 1
mp911de
  • 16,333
  • 2
  • 47
  • 89