Hi, yes I agree, it looks like there’s something wrong with the TypeScript types.
If you define a type for your collection it works:
type MySchema = {
id: number;
scores: number[];
};
const collection = db.collection<MySchema>('array');
await collection.updateMany(
{},
{ $push: { scores: 95 } }
);
Tip: You should also await
the updateMany()
call.