[MONGOOSE/MONGODB] How can I get a specific users schema?

Hello! I've been coding for the past few hours and can't exactly seem to figure this out so I've been trying to get a specific users totalMessages (from schema) at a specific date, heres my code (this is being run inside my command file, level/messages.js):
const totalMessagesData = UserDocument.totalMessages
const todayMessages = UserModel.find({
createdAt: {
$gte: today.toDate(),
$lte: moment(today).endOf('day').toDate()
}
})

console.log(todayMessages.model.schema.paths.totalMessages.validators)
const totalMessagesData = UserDocument.totalMessages
const todayMessages = UserModel.find({
createdAt: {
$gte: today.toDate(),
$lte: moment(today).endOf('day').toDate()
}
})

console.log(todayMessages.model.schema.paths.totalMessages.validators)
My totalMessages in schema is a number value, and I've been trying to get it but all I get in console from:
console.log(todayMessages.model.schema.paths.totalMessages.validators)
console.log(todayMessages.model.schema.paths.totalMessages.validators)
is:
{
validator: [Function (anonymous)],
message: 'Path `{PATH}` is required.',
type: 'required'
}
]
{
validator: [Function (anonymous)],
message: 'Path `{PATH}` is required.',
type: 'required'
}
]
Would appeciate any help šŸ™‚
3 Replies
d.js toolkit
d.js toolkitā€¢12mo ago
ā€¢ What's your exact discord.js npm list discord.js and node node -v version? ā€¢ Post the full error stack trace, not just the top part! ā€¢ Show your code! ā€¢ Explain what exactly your issue is. ā€¢ Not a discord.js issue? Check out #useful-servers.
adam
adamā€¢12mo ago
Discord.js version: 13.1.0 NodeJS version: 18.12.1
megatank58
megatank58ā€¢12mo ago
Hello, this channel is for questions regarding discord.js, please ask in #other-js-ts for help regarding mongodb and any unrelated libraries