Please help me how to use simple database inside Colyseus

I need a simple feature that can save the high score and the country of the user after match end. And then after that, I can query score by country, by friend and show the leaderboard.
Would you please comment how to add simple database (likes mysql ...) database to Colyseus, what driver, plugins I should use for simple usage, I just a noob in javascript.
Thank so much for your support!

Hi @takaaptech,

I recommend using MongoDB, since you wouldn't bother about creating a schema for your tables.

You can either use the barebones mongodb driver, or use a high-level abstraction for it, such as mongoose. Both are quite simple to set up and use.


Hey, thank @endel so much for the super quick help!
When working with Mongoose Database I guess we should (or must) using Promise like the pattern from this doc:
So would you please help me what is the plugins docs about Promise that Colyseus are using
Some link about docs and common usage would be great for a newbie like me!
Thank again for the awesome support!

Hey @takaaptech, Node has native support for Promises, you don't need to get any additional package/plugins in order to work with them. Cheers!

Hi @endel ! Thank so much!