Last active
May 31, 2023 07:34
-
-
Save derjohn/0c31c0c241256fb9d0862911321bbbd7 to your computer and use it in GitHub Desktop.
Rocket.Chat rocket mongodb mongo basic operations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use rocketchat | |
# Change E-Mail Adress | |
db.getCollection('users').updateOne( | |
{ username: "Temp" }, | |
{ | |
$set: { emails: [ { "address" : "ajo@example.com", "verified" : true } ] } | |
} | |
) | |
# Update Credentials | |
db.getCollection('users').updateOne( | |
{ username: "Temp" }, | |
{ | |
$set: { "services" : { "password" : { "bcrypt" : "$2b$xxxxxxxxx" }, "email2fa" : { "enabled" : false, "changedAt" : ISODate("2022-08-25T07:22:07.181Z") } } } | |
} | |
) | |
# delete banners | |
db.getCollection('users').updateOne( | |
{ username: "username" }, | |
{ | |
$set: { "banners" : { } } | |
} | |
) | |
# find a user object | |
db.getCollection('users').find( { username: 'some_usser' } ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment