tecbot/mongodb-odm — comment on commit dd10565b70e2a82a302264603a6b909eebc49b29
File:  line 0
By jmikola:

I suspect this commit has broken support for creating array indexes. Consider @avalanche123's SitemapBundle and its schema definition:

```yml
Avalanche\Bundle\SitemapBundle\Sitemap\Url:
type: document
repositoryClass: Avalanche\Bundle\SitemapBundle\Document\UrlRepository
indexes:
- { keys: { loc: 1}, options: { unique: 1 } }
- { keys: { lastmod: 1}, options: {} }
- { keys: { images.loc: 1 }, options: {} }
fields:
id:
id: true
type: id
strategy: auto
loc:
type: string
lastmod:
type: date
changefreq:
type: string
priority:
type: string
embedMany:
images:
targetDocument: Avalanche\Bundle\SitemapBundle\Sitemap\Url\Image

Avalanche\Bundle\SitemapBundle\Sitemap\Url\Image:
type: embeddedDocument
fields:
loc:
type: string
caption:
type: string
geoLocation:
type: string
title:
type: string
license:
type: string
```

When creating indexes from the command line, an exception is raised stating: `No mapping found for field 'images.loc' in class 'Avalanche\Bundle\SitemapBundle\Sitemap\Url'`. The stacktrace points back to SchemaManager changes from this commit:

```
#0 /home/jmikola/workspace/exercise/vendor/doctrine-mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataInfo.php(1306): Doctrine\ODM\MongoDB\MongoDBException::mappingNotFound('Avalanche\Bundl...', 'images.loc')
#1 /home/jmikola/workspace/exercise/vendor/doctrine-mongodb-odm/lib/Doctrine/ODM/MongoDB/SchemaManager.php(115): Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo->getFieldMapping('images.loc')
#2 /home/jmikola/workspace/exercise/vendor/doctrine-mongodb-odm/lib/Doctrine/ODM/MongoDB/SchemaManager.php(77): Doctrine\ODM\MongoDB\SchemaManager->prepareIndexes(Object(Doctrine\ODM\MongoDB\Mapping\ClassMetadata))
#3 /home/jmikola/workspace/exercise/vendor/doctrine-mongodb-odm/lib/Doctrine/ODM/MongoDB/SchemaManager.php(65): Doctrine\ODM\MongoDB\SchemaManager->doGetDocumentIndexes('Avalanche\Bundl...', Array)
#4 /home/jmikola/workspace/exercise/vendor/doctrine-mongodb-odm/lib/Doctrine/ODM/MongoDB/SchemaManager.php(136): Doctrine\ODM\MongoDB\SchemaManager->getDocumentIndexes('Avalanche\Bundl...')
#5 /home/jmikola/workspace/exercise/vendor/doctrine-mongodb-odm/lib/Doctrine/ODM/MongoDB/SchemaManager.php(58): Doctrine\ODM\MongoDB\SchemaManager->ensureDocumentIndexes('Avalanche\Bundl...')
#6 /home/jmikola/workspace/exercise/vendor/doctrine-mongodb-odm/lib/Doctrine/ODM/MongoDB/Tools/Console/Command/Schema/CreateCommand.php(43): Doctrine\ODM\MongoDB\SchemaManager->ensureIndexes()
```