Hi there. So I have a Discord Bot (Discord.js v14.11.0 with Node 18.17.0) for a written text roleplaying game, with players having their own characters and each character having their own inventory. I've hit a snag in the inventory though, I can create it just fine, I can add items to it just fine, I can view the inventory via command just fine, but the moment I try to use an item from the inventory, it never works out. I have the item named stored, and then when I type the command to use an item, I type the name of said item, yet the code keeps reporting that the isn't in my inventory when it is (something I'm sure not only from looking at my database, but also from using the viewinventory command which works fine). I've tried copy pasting the name directly from the database, tried parsing toLowerCase, nothing. Console logging the Mongoose.find query returns as undefined and I just don't understand why. Here's a pastebin of my useitem code:
And here's a pastebin of the two schemas I am using in there, as well as the subschema:
Whenever I try the command and log it via console.log('Inventory Item:', inventoryItem);, the log comes back as Inventory Item: null, and the interaction.reply comes back as "You don't have Bandana in your inventory." (I used Bandana for my tests). Here's a screenshot of the document where Bandana is, the writing is absolutely correct and I have even copy pasted directly from the database just in case... Still nothing.
The second screenshot is of my inventory collection, just in case it helps somehow.
Can someone please help, even if just pointing me in the right direction?