deno.land / x / mongoose@6.7.5 / tools / auth.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'use strict';
const Server = require('mongodb-topology-manager').Server;const mongodb = require('mongodb');
run().catch(error => { console.error(error); process.exit(-1);});
async function run() { // Create new instance const server = new Server('mongod', { auth: null, dbpath: '/data/db/27017' });
// Purge the directory await server.purge();
// Start process await server.start();
const db = await mongodb.MongoClient.connect('mongodb://localhost:27017/admin');
await db.addUser('passwordIsTaco', 'taco', { roles: ['dbOwner'] });
console.log('done');}
mongoose

Version Info

Tagged at
a year ago