Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR - How to create some things in the database mongodb #6

Closed
Lucifer101010 opened this issue Mar 21, 2022 · 0 comments
Closed

ERROR - How to create some things in the database mongodb #6

Lucifer101010 opened this issue Mar 21, 2022 · 0 comments

Comments

@Lucifer101010
Copy link

Hey how to create some things in the database mongodb because it's return

`throw error;
^

TypeError: Cannot read properties of undefined (reading '0')
at /home/pi/Documents/a.-./stats-king/index.js:34:48`

here is the line (line 29 to 37):

app.get('/', (req, res) => { db.collection('playerLeaderboard').find({ id : 'global' }).toArray((err, docs) => { if(err) console.log(err) db.collection('clanLeaderboard').find({ id : 'global' }).toArray((err, docs2) => { if(err) console.log(err) res.render('home', { players : docs[0].playerLeaderboard.slice(0, 10), clans : docs2[0].clanLeaderboard.slice(0, 10)}) }) }) })

thanks for your response !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant