s = field.getSchema();
fs = s != null ? s.getFields() : null;
BasicBSONObject inputMap = (BasicBSONObject) obj;
Map outputMap = new HashMap();
for (String key : inputMap.keySet()) {
if (fs != null) {
outputMap.put(key, readField(inputMap.get(key), fs[0]));
} else {
outputMap.put(key, readField(inputMap.get(key), null));
}