How to pull the string from mongodb?

Hi all, I have added in the database data, which can not correctly display at ejs!
Here is how I take data from dB:
app.get('/ads/check',async (req,res,next) => {
 await Ads.find({}).then(result => {
 const login = req.session.login
 Res. render('check', {
 title: "Your ad on the website!",
 login: login,
result
})
})
})


Here is the dB structure:
var ads = new Schema({
 name: String,
 iframe: String
})
var Ads = mongoose.model('Ads', ads)


How to bring now name and an iframe on the ejs page?
Ie how to pass an object and not a string?

Use a stack node js express js and mongoose
April 9th 20 at 10:31
2 answers
April 9th 20 at 10:33
Const result = await Ads.find() , and result in the render?
And as we now show for example only a line name? - ted.Muraz commented on April 9th 20 at 10:36
Well, in the ejs don't know hbs result.name.MB using the foreach loop in the ejs,in colback put the item and get the item.name - Rodger.Prosacco97 commented on April 9th 20 at 10:39
April 9th 20 at 10:35
not entirely sure about the syntax for ejs, but

<%- [here the name of the string variable ID] %>

<%- result.iframe %>


and then just have in html to insert iframe code

Find more questions by tags MongoDBNode.jsMongooseExpress.js