mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-21 16:52:00 -07:00
32 lines
784 B
JavaScript
32 lines
784 B
JavaScript
import mongoose from 'mongoose'
|
|
import config from '../../../config/index.js'
|
|
import User from '../../../src/adapters/localdb/models/users.js'
|
|
|
|
async function getUsers () {
|
|
// Connect to the Mongo Database.
|
|
mongoose.Promise = global.Promise
|
|
mongoose.set('useCreateIndex', true) // Stop deprecation warning.
|
|
await mongoose.connect(
|
|
config.database,
|
|
{ useNewUrlParser: true, useUnifiedTopology: true }
|
|
)
|
|
|
|
// Find the user by email.
|
|
const user = await User.findOne({
|
|
email: 'test@test.com'
|
|
}, '-password')
|
|
// console.log('user: ', user)
|
|
|
|
// Update the users password
|
|
user.password = 'test'
|
|
|
|
// Change the user to an admin
|
|
// user.type = 'admin'
|
|
|
|
// Save the changes to the database.
|
|
await user.save()
|
|
|
|
mongoose.connection.close()
|
|
}
|
|
getUsers()
|