* @throws IOException
*/
public T newInstance(final DBObject obj, final String[] fields) {
if (obj == null)
return null;
BSONDecorator easybson = new BSONDecorator(obj);
// Create new empty persistent bean instance
T persistent = newPersistent();
String[] dbFields = getFieldsToQuery(fields);
// Populate each field
for (String f : dbFields) {
// Check the field exists in the mapping and in the db
String docf = mapping.getDocumentField(f);
if (docf == null || !easybson.containsField(docf))
continue;
DocumentFieldType storeType = mapping.getDocumentFieldType(docf);
Field field = fieldMap.get(f);
Schema fieldSchema = field.schema();