Answer the question
In order to leave comments, you need to log in
Java+Spring+Mongo How to pull an object from a collection by the value of an array element?
In the collection, an object containing the "ask" field as an array of options and "answer" as a string
A request comes from the client - "a certain word" and if there is such a value in the object's array, the object itself is returned.
If instead of ask just a String I got the object easily with this
@Repository
public interface PostRepository extends MongoRepository<Answer, String> {
public Answer findAnswerByAsk(String ask);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question