Merge pull request 'get count by modelname' (#38) from feature/check-jenkins into master
Reviewed-on: #38
This commit is contained in:
commit
bbc315e270
@ -17,7 +17,16 @@ router.get('/', async (req, res) => {
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>models</h2>
|
<h2>models</h2>
|
||||||
<ul>${(await mongoose.modelNames()).map((name) => `<li>${name}</li>`)}</ul>
|
<ul>${
|
||||||
|
(await Promise.all(
|
||||||
|
(
|
||||||
|
await mongoose.modelNames()).map(async (name) => {
|
||||||
|
const count = await mongoose.model(name).countDocuments()
|
||||||
|
return `<li>${name} - ${count}</li>`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)).map(t => t).join(' ')
|
||||||
|
}</ul>
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user