mongorito
mongorito copied to clipboard
Value is returning null after query
I am trying to query a document in the database like so:
const tag = await tags.findOne({
guildID: msg.guild.id,
tagName: collected.first().content,
tagInfo: {
author: msg.author.id
}
})
msg.author.id is defined as 288855795951599617, msg.guild.id is defined as 321417443585032203 and collected.first().content is defined as "Test"
My document is
{
"_id" : ObjectId("5968bbe5525fa71609bd5d57"),
"guildID" : "321417443585032203",
"tagName" : "Test",
"tagContent" : "Test add",
"tagInfo" : {
"author" : "288855795951599617",
"createdAt" : ISODate("2017-07-14T12:41:02.931Z")
}
}
Whenever I query, it is null. Am I querying this wrong? I don't believe I am.
Check if guild.id
and author.id
are in fact strings, not ObjectId
s.
They are in fact strings. I attached .toString() just in case.
Could you create an isolated reproduction for this? Ideally, this is a separate git repository that I can clone and reproduce the bug. This would help tremendously in resolving this issue.