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
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Ashura
AshuraOP2y ago
İspik
İspik2y ago
data seems to be undefined sounds like mongodb issue Probably failed to match the query
Ashura
AshuraOP2y ago
got any ideia on how to correct this?
İspik
İspik2y ago
Well send me your mongodb schema model
Ashura
AshuraOP2y ago
const { model, Schema } = require("mongoose"); let logSchema = new Schema({ Guild: String, Channel: String, }); module.exports = model("Logs", logSchema);
İspik
İspik2y ago
Have you ever made a write to the database?
Ashura
AshuraOP2y ago
how can i do it
İspik
İspik2y ago
Well there's findOneAndUpdate method you should use it somewhere to put something inside database
Ashura
AshuraOP2y ago
İspik
İspik2y ago
Not exactly optimal but could work
Ashura
AshuraOP2y ago
same thing , still didnt work
İspik
İspik2y ago
Open your mongo atlas and see if there's anything inside it
Ashura
AshuraOP2y ago
nothing
İspik
İspik2y ago
So you're not inserting it correctly you might need to add .save() on the end of the .create() method
Want results from more Discord servers?
Add your server