#returning undefined
14 messages · Page 1 of 1 (latest)
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
✅Marked as resolved by OP
If that’s mongoose you should probably use findAll. And the result is already an iterable. You shouldn’t add it to an array (of length 1) to then forEach it (which will run exactly once) while trying to access properties on the iterable itself (which don’t exist, because they only exist on the elements of the iterable)
if I don't put it in an array it'll say that forEach isn't a function
and findAll isn't a thing I'm pretty sure
I looked through the documentation and it's findOne for one document and just find for multiple
It should though
console.log(existUsername) then
it shows both of the packs
it created both fields now, but everything is undefined
when I'm using findOne it works fine, but as soon as I use find it just stops working
so I think it's having trouble distinguishing the 2 packs and wants to throw everything everywhere?
Because you don’t get the properties from the parameter of the forEach callback but still try to get it from the array itself
Should be u.packName and u.packCreator