documentClass - the document class in scope for the collection. This parameter may be ignored, but it may be used to alter
the structure of the returned BsonDocument based on some knowledge of the document class.

codecRegistry - the codec registry. This parameter may be ignored, but it may be used to look up Codec instances for
the document class or any other related class.

get

Gets the value of the given key, casting it to the given Class<T>. This is useful to avoid having casts in client code,
though the effect is the same. So to get the value of a key that is of type String, you would write String name =
doc.get("name", String.class) instead of String name = (String) doc.get("x") .

Type Parameters:

T - the type of the class

Parameters:

key - the key

clazz - the non-null class to cast the value to

Returns:

the value of the given key, or null if the instance does not contain this key.