I store the myCollection key from the DB into a ownedProducts variable, if I console.log inside the IF statement I can see the value is there. Then I pass the ownedProduct variable in the res.render but here it just log {}. <% console.log (catalogList) %> <% console.log (myUserCollection) %>. catalogList is taken from a JSON file and it shows .... . Answer by Nash Delarosa Now to access that data in the script tag of EJS file or the .js file all you need to do is to pass that data in another variable as below:,Now you can perform any operation on the data variable which has the same value as EJS passed data variable.,Data passed from the server is sent to the EJS file and then we can access that data using the below line and it will give. "/>Ejs variables