Line 318: |
Line 318: |
| db.rocketchat_settings.findOne({_id : "SMTP_Host"}, {_id:0, value: 1}) | | db.rocketchat_settings.findOne({_id : "SMTP_Host"}, {_id:0, value: 1}) |
| | | |
− | db.rocketchat_settings.update({"_id" <nowiki>: "From_Email"}, {$set: {"value":"admin@yourdomain.com"}}) | + | db.rocketchat_settings.update({"_id":"From_Email"}, {$set: {"value":"admin@yourdomain.com"}}) |
− | db.rocketchat_settings.update({"_id"</nowiki> <nowiki>: "SMTP_Host"}, {$set: {"value":"mail.yourdomain.com"}})</nowiki>
| + | db.rocketchat_settings.update({"_id":"SMTP_Host"}, {$set: {"value":"mail.yourdomain.com"}}) |
| | | |
| | | |
Line 327: |
Line 327: |
| Help | | Help |
| help | | help |
| + | |
| + | Some more mongo commands for reference |
| + | |
| + | https://github.com/RocketChat/Rocket.Chat/issues/15880#issuecomment-570070433 |
| + | |
| + | Directly check a specific user ID from bash: |
| + | mongo rocketchat --eval "db.users.find({'username':'usernamehere'}).forEach( function(u) { print(u._id + \" ; \" + u.username); } )" |
| + | |
| + | Log into rocketchat database: |
| + | mongo rocketchat |
| + | |
| + | Check out all the user IDs in the database: |
| + | db.users.find().forEach( function(u) { print(u._id + ";" + u.username); } ) |
| + | |
| + | Or just a specific user's ID: |
| + | db.users.find({'username':'usernamehere'}).forEach( function(u) { print(u._id + \" ; \" + u.username); } ) |
| + | |
| + | Replace specific user ID's password in the database: |
| + | db.users.update( {'_id': 'useridhere'}, {$set: {'services.password.bcrypt': 'bcryptedpasswordhere'}}, {multi:true} ) |
| + | |
| + | My only issue with above (only time I needed it for recovery purposes), was that I didn't know which tool to use to generate a bcrypted password. So in the hurry I copied the hash from one account I already knew (my own). If someone knows a good command for creating one directly in bash, I assume it would do. |
| + | |
| + | There are bcrypt password generators online, and various libraries you can use |
| + | |
| + | For listing out any passwords in the database I used: |
| + | |
| + | db.users.find().forEach( function(u) { print(u.services.password.bcrypt + " ; " + u.username); } ) |
| + | |
| + | If you have deactivated users it may fail so use this for individual accounts. |
| + | |
| + | However, you can get it for an individual user with: |
| + | |
| + | db.users.find({'username':'SomeUserName'}).forEach( function(u) { print(u.services.password.bcrypt + " ; " + u.username); } ) |
| + | |
| | | |
| ===Database Backup=== | | ===Database Backup=== |