user2137817 :
I have documents
(using mongodb
) which has a list of ObjectId
as one of the variables and I wanna filter those documents based on if this list contains a certain element, so I was wondering if Containing
works as well on lists (findByListContaining(id)
), I couldn't find anything regarding lists, only String
.
Thanks.
Class FooClass{
List<ObjectId> barIds;
}
pvpkiran :
Look at the example on spring-data-mongodb here
Look at this method specifically
Person findByShippingAddresses(Address address);
shippingAddress is defined as
private Set<Address> shippingAddresses;
In Person class. Which means it works for List as well.
In your case a method like this should work
findByBarIds(ObjectId barId)
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=370854&siteId=1