return new SavedMember({
id: member.id, // ID of the user
guildId: member.guild.id // ID of the guild
}).save();
выдает ошибку:
message: 'Cast to ObjectId failed for value "218459216145285121" at path "_id" for model "member"',
name: 'CastError',
model: Model { member }
member.ts
const memberSchema = new Schema({
_id: Types.ObjectId,
id: String,
guildId: String,
xpMessages: { type: Number, default: 0 },
warnings: { type: Array, default: [] }
});
...
export const SavedMember = model<MemberDocument>('member', memberSchema);
Репо: https://github.com/theADAMJR/2pg-dashboard