Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Value is returning null after query #189

Open
Texlo-Dev opened this issue Jul 14, 2017 · 3 comments
Open

Value is returning null after query #189

Texlo-Dev opened this issue Jul 14, 2017 · 3 comments

Comments

@Texlo-Dev
Copy link

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.

@vadimdemedes
Copy link
Owner

Check if guild.id and author.id are in fact strings, not ObjectIds.

@Texlo-Dev
Copy link
Author

They are in fact strings. I attached .toString() just in case.

@vadimdemedes
Copy link
Owner

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants