I'm trying to make it so that if you use a command, it sends all the content of my MongoDB schema. For some reason, it won't work and is printing this error: "TypeError: Cannot read properties of null (reading 'eventName')"
Here's the code, thanks.
else if (command === 'events') {
const allEvents = EventDatabase.find()
let desc = '';
for (const i in allEvents) {
desc += `${allEvents[i].eventName}). ${allEvents[i].eventInfo}\n`
}
await message.channel.send(desc)