You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After an update from 5.11.17 to 5.13.7, I'm seeing this error when trying to update a list of subdocuments.
Type 'IGameEvent[]' is not assignable to type 'LeanDocument<IGameEventDocument>[]'.
Type 'IGameEvent' is missing the following properties from type 'LeanDocument<IGameEventDocument>': ownerDocument, parent
// gameRecord: IGameDocumentgameRecord.update({status: GameStatus[fixture.status.short],awayTeamScore: goals.away,homeTeamScore: goals.home,venue: fixture.venue.name,date: newDate(fixture.date),// this is complaining. mapFixtureEvents is returning IGameEvent[] and events is expecting LeanDocument<IGameEventDocument>events: FootballApiMappings.mapFixtureEvents(events),});
How can I update a subdocument with a plain object?
// TypeScript doesn't complain here
gameRecord.events.push(FootballApiMappings.mapFixtureEvents(events));
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Mongoose version: 5.13.7
After an update from 5.11.17 to 5.13.7, I'm seeing this error when trying to update a list of subdocuments.
How can I update a subdocument with a plain object?
Thanks :)
Beta Was this translation helpful? Give feedback.
All reactions