String userId = "1234L";
Map<String, WidgetRating> wr = Maps.newHashMap();
List<Widget> widgets = Lists.newArrayList();
List<WidgetRating> widget_ratings = Lists.newArrayList();
Widget widget = new WidgetImpl("1111L");
WidgetRating rating1 = new WidgetRatingImpl();
WidgetRating rating2 = new WidgetRatingImpl();
rating1.setUserId(userId);
rating2.setUserId("5555L");
widget_ratings.add(rating1);
widget_ratings.add(rating2);
widget.setRatings(widget_ratings);
widgets.add(widget);
Query q = query(where("ratings").elemMatch(where("userId").is(userId)));