On this page
Breaking Changes
The v1.4 branch is the legacy line and is considered stable.
The API is the same as v1.3, so no code changes are needed to upgrade from v1.3. These are the things that can still affect you.
For the full list of changes, see the changelog.
Requirements
Section titled “Requirements”- Node.js
16.20.1or newer (v1.3 worked on Node.js 14.20.1). - MongoDB
4.2or newer (v1.3 worked on MongoDB 3.6). discord.js^13.12.0or^14.19.0.
mongoose
Section titled “mongoose”simply-xp now uses the official mongodb driver and no longer installs mongoose. It also no longer shares or changes the mongoose connection of your own code. If your bot used mongoose through simply-xp, install it and connect it yourself.
Errors
Section titled “Errors”Failed database writes now reject instead of only being logged, and connect() rejects if it cannot connect. Add a .catch (or a try/catch around await) to your calls.
Database indexes
Section titled “Database indexes”connect() replaces the old one-record-per-user index with a user + server index, so a user can have XP in more than one server. The database user needs permission to create and drop indexes; the built-in readWrite role has it. Without it, the old index stays, and a user can still only have XP in one server.
If you run several processes on one database, upgrade them all together.
Behavior
Section titled “Behavior”- XP no longer goes below
0, and fractional levels are rounded down. levelUpalso fires for new users who start above level 0.lvlRole()throws when the user ID or server ID is missing.roleSetup.remove()also matches a level stored as"3"when given3.fetch()andleaderboard()show a billion as1B, not1T.
Upgrading to V2?
Section titled “Upgrading to V2?”See the V2 breaking changes.