I am trying to display a field that contains a image link and that is nested in my collection in MongoDB to ejs. However when i try to display it to ejs it can’t find the image… I am using the User schema so when I write: <%=user.slot1img%> then it won’t be able to find that resource.
The structure is like this for each item:
Inventory: [
{
Item1: [
{
slot1img: "",
slot1text: "",
}
],
I tried to do this for exampe: <%=user.Inventory[Item1]% but i get the error that Item1 is not defined.
So how could I show a for example slot1img if its nested in mongodb to the EJS file?