These are chat archives for Automattic/mongoose

28th
Aug 2017
Christofer Huber
@crebuh
Aug 28 2017 08:08

Good Morning, I've got a problem with a two-dimensional array. The property in my schema is defined like this:

highlights: [[descSchema]]

const descSchema = new mongoose.Schema({
language: { type: String, required: true },
description: { type: String, required: true }
}, { _id: false });

when I'm reading the data from the db everything is fine. When I'm inserting oder updating the data I got this error:

'UpdateEntityException: TypeError: Cannot read property \'castForQuery\' of undefined',

the data structure looks like this:

       "highlights" : [ 
        [ 
            {
                "language" : "de",
                "description" : "Highlight 1"
            }, 
            {
                "language" : "en",
                "description" : "Highlight 1"
            }
        ], 
        [ 
            {
                "language" : "de",
                "description" : "Highlight 2"
            }, 
            {
                "language" : "en",
                "description" : "Highlight 2"
            }
        ],
]

any idea on how to solve this issue?