mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-22 01:02:00 -07:00
20 lines
549 B
JavaScript
20 lines
549 B
JavaScript
import mongoose from 'mongoose'
|
|
import config from '../../config/index.js'
|
|
import User from '../../src/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 }
|
|
)
|
|
|
|
const users = await User.find({}, '-password')
|
|
console.log(`users: ${JSON.stringify(users, null, 2)}`)
|
|
|
|
mongoose.connection.close()
|
|
}
|
|
getUsers()
|