public static Bson elemMatch ( final String fieldName , final Bson filter ) { return new Bson ( ) { @ Override public < TDocument > BsonDocument toBsonDocument ( final Class < TDocument > documentClass , final CodecRegistry codecRegistry ) { return new BsonDocument ( fieldName , new BsonDocument ( "$elemMatch" , filter . toBsonDocument ( documentClass , codecRegistry ) ) ) ; } } ; }
Creates a filter that matches all documents containing a field that is an array where at least one member of the array matches the given filter .