Minor FYI....Elasticsearch has made a strong stand that they are not a database. There are certain levels of consistency and reliability to qualify as a database that they have said they cannot support. But if your data isn't critical, and you don't mind a noticeable a delay between when you write a document and when it available for reading, then that's fine. 🙂
Presuming you are jacked into the command line on the server hosting your mongodb, it should be something like this:
mongodump --out /var/backups/mongo/$(date +%F)
I say "something like" because the simple form above would represent a poorly secured mongodb. Hence, you will most likely need a few additional flags:
mongodump -u "YourDbAdminUser" -p "SomePassPhrase" --out /var/backups/mongo/$(date +%F) --authenticationDatabase=admin
Upon successful completion that command will create a directory structure under /var/backups/mongo containing a full backup of your mongo database(s). You will then need to mongorestore this to your new server.
Mind you, the above only gets the database. You will likely also want the public file uploads and such. I suggest you review the NodeBB Upgrade Docs for further clarification.
You can copy the entire database if the database is used only for nodebb
mongodump -o /mydir/
when transferring a database to another server, you need to copy the database dump and run the command
The user and all the data will be automatically transferred