DEV Community

Ipicky2
Ipicky2

Posted on • Updated on

Call data ejs to database MongoDB

Hi, for a web development project, i need to send data from my database to my index.ejs, to display. It's a success ! Now I would like recover the same data and send to another collection in my database.
(I display my products with "products collection", and when the user clicks on "buy", the product is sending to "basket collection".)
If somebody can help me. I have my two functions on the same .js.
I attached the screen of index.ejs and method.js (where I do my functions).

index.ejs (display) :
https://thepracticaldev.s3.amazonaws.com/i/lx9yvtejp261xncmcxvd.png

method.js (function basket) :
https://thepracticaldev.s3.amazonaws.com/i/3ee21psgg0i3qh92pyhh.png

method.js (function products to display on index.ejs) :
https://thepracticaldev.s3.amazonaws.com/i/zaskox2q384li0lqr7yz.png

Top comments (0)