aws-documentdb-mongoapiaws-documentdb

multiple fields of compound index cannot be arrays


I am getting this error while migrating data from mongodb to documentdb. Indexes were created on documentdb side without problems.

2019-04-26T17:40:20.118+0000    error: multiple fields of compound index cannot be arrays
2019-04-26T17:40:20.445+0000    error: multiple fields of compound index cannot be arrays
2019-04-26T17:40:22.057+0000    error: multiple fields of compound index cannot be arrays

I see similar questions asked way back about mongodb, how is documentdb implementation differ from it? I did not see any issues while creating indexes in documentdb, only see it in restore during the restore


Solution

  • Amazon DocumentDB does not yet support creating a compound index with multiple keys on the same array. A workaround is to create individual indexes on the desired array fields, as the Amazon DocumentDB query planner is capable of using multiple indexes in a single query.

    https://docs.aws.amazon.com/documentdb/latest/developerguide/functional-differences.html