src/AnnotationGenerator/DoctrineMongoDBAnnotationGenerator.php
public function generateFieldAnnotations(string $className, string $fieldName): array
    {
        $field = $this->classes[$className]['fields'][$fieldName];
        if ($field['isId']) {
            return $this->generateIdAnnotations();
        }

        $annotations = [];

        if ($field['isEnum']) {
            $type = $field['isArray'] ? 'simple_array' : 'string';
        } else {
            switch ($field['range']) {
                case 'Boolean':
                    $type = 'boolean';
                    break;
                case 'Date':
                case 'DateTime':
                    $type = 'date';
                    break;
                case 'Time':
                    $type = 'time';
                    break;
                case 'Number':
                case 'Float':
                    $type = 'float';
                    break;
                case 'Integer':
                    $type = 'integer';
                    break;
                case 'Text':
                case 'URL':
                    $type = 'string';
                    break;
            }
        }

        if (isset($type)) {
            $annotation = '@MongoDB\Field';

            if ($field['isArray']) {
                $type = 'collection';
            }

            $annotation .= sprintf('(type="%s")', $type);

            $annotations[] = $annotation;
        } else {
            if (CardinalitiesExtractor::CARDINALITY_0_1 === $field['cardinality']
                || CardinalitiesExtractor::CARDINALITY_1_1 === $field['cardinality']
                || CardinalitiesExtractor::CARDINALITY_N_0 === $field['cardinality']
                || CardinalitiesExtractor::CARDINALITY_N_1 === $field['cardinality']) {
                $annotations[] = sprintf('@MongoDB\ReferenceOne(targetDocument="%s", simple=true))', $this->getRelationName($field['range']));
            } elseif (CardinalitiesExtractor::CARDINALITY_0_N === $field['cardinality']
                || CardinalitiesExtractor::CARDINALITY_1_N === $field['cardinality']
                || CardinalitiesExtractor::CARDINALITY_N_N === $field['cardinality']) {
                $annotations[] = sprintf('@MongoDB\ReferenceMany(targetDocument="%s", simple=true)', $this->getRelationName($field['range']));
            }
        }

        return $annotations;
    }
public function generateFieldAnnotations(string $className, string $fieldName): array
    {
        $field = $this->classes[$className]['fields'][$fieldName];
        if ($field['isId']) {
            return $this->generateIdAnnotations();
        }

        $annotations = [];

        if ($field['isEnum']) {
            $type = $field['isArray'] ? 'simple_array' : 'string';
        } else {
            switch ($field['range']) {
                case 'Boolean':
                    $type = 'boolean';
                    break;
                case 'Date':
                case 'DateTime':
                    $type = 'date';
                    break;
                case 'Time':
                    $type = 'time';
                    break;
                case 'Number':
                case 'Float':
                    $type = 'float';
                    break;
                case 'Integer':
                    $type = 'integer';
                    break;
                case 'Text':
                case 'URL':
                    $type = 'string';
                    break;
            }
        }

        if (isset($type)) {
            $annotation = '@MongoDB\Field';

            if ($field['isArray']) {
                $type = 'collection';
            }

            $annotation .= sprintf('(type="%s")', $type);

            $annotations[] = $annotation;
        } else {
            if (CardinalitiesExtractor::CARDINALITY_0_1 === $field['cardinality']
                || CardinalitiesExtractor::CARDINALITY_1_1 === $field['cardinality']
                || CardinalitiesExtractor::CARDINALITY_N_0 === $field['cardinality']
                || CardinalitiesExtractor::CARDINALITY_N_1 === $field['cardinality']) {
                $annotations[] = sprintf('@MongoDB\ReferenceOne(targetDocument="%s", simple=true))', $this->getRelationName($field['range']));
            } elseif (CardinalitiesExtractor::CARDINALITY_0_N === $field['cardinality']
                || CardinalitiesExtractor::CARDINALITY_1_N === $field['cardinality']
                || CardinalitiesExtractor::CARDINALITY_N_N === $field['cardinality']) {
                $annotations[] = sprintf('@MongoDB\ReferenceMany(targetDocument="%s", simple=true)', $this->getRelationName($field['range']));
            }
        }

        return $annotations;
    }
{@inheritdoc}