Cannot read properties of undefined (reading 'Channel')
TypeError: Cannot read properties of undefined (reading 'Channel')
at C:\Users\luizs\Documents\Discord Bot\Handlers\handleLogs.js:8:63
at C:\Users\luizs\Documents\Discord Bot\node_modules\mongoose\lib\model.js:5213:18
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
15 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
data seems to be undefined sounds like mongodb issue
Probably failed to match the query
got any ideia on how to correct this?
Well send me your mongodb schema model
const { model, Schema } = require("mongoose");
let logSchema = new Schema({
Guild: String,
Channel: String,
});
module.exports = model("Logs", logSchema);
Have you ever made a write to the database?
how can i do it
Well there's
findOneAndUpdate
method you should use it somewhere to put something inside databaseNot exactly optimal but could work
same thing , still didnt work
Open your mongo atlas and see if there's anything inside it
nothing
So you're not inserting it correctly
you might need to add .save() on the end of the .create() method