on-internet
← Community

spring-data-mongo querying arrays example

Stack Overflow ·

I am newbie to the spring-data-mongo. I've the following documents Food and I would like to query using Querying Arrys. I've following Food collection > db.food.find() { "_id" : 1, "fruit" : [ "apple", "banana", "peach" ] } { "_id" : 2, "fruit" : [ "apple", "kumquat", "orange" ] } { "_id" : 3, "fruit" : [ "cherry", "banana", "apple" ] } > And I am using following query I get the proper data. Now same I would like to achieve using Spring-data-mongo > db.food.find({fruit : {$all : ["apple","banana"]}}) { "_id" : 1, "fruit" : [ "apple", "banana", "peach" ] } { "_id" : 3, "fruit" : [ "cherry", "ba

Comments

Sign in or sign up to comment and upvote.

No comments yet.