@Override public Class<?> getFieldType() { if (!isIdProperty()) { return getType(); } MongoId idAnnotation = findAnnotation(MongoId.class); if (idAnnotation == null) { return FieldType.OBJECT_ID.getJavaClass(); } FieldType fieldType = idAnnotation.targetType(); if (fieldType == FieldType.IMPLICIT) { return getType(); } return fieldType.getJavaClass(); }