I got this structure in my mongodb (2 collections: restaurant
and cocktail
)
restaurant {id=1001, name="Res1", coor=[12.392, 19.123], cocktail=[13, 0, 92]}
cocktail {id=13, name="Capiroska"}, {id=167, name="Capirinha"}, {id=92, name="Negroni"}, {id=0, name="Martini"}
Multiple restaurant
s and multiple cocktail
s, N:N relationship.
My goal is to find which different cocktail
s I can drink within a specified area.
I've already written a query that finds all restaurants near my position like this:
mongoTemplate.find(new Query(Criteria.where("address.location").withinSphere(new Circle(latitude, longitude, radius/6371))
), Restaurant.class);
So that I obtain a list of restaurant
s.
Next steps are:
How to obtain distinct
cocktail
'sid
(no repetitions allowed)How to look into
cocktail
collection in order to obtain allcocktail
names
TY in advance!