I found a good way to get the user list out of mongodb. In case anyone need it:
async function doMongoDb() { const { MongoClient } = require("mongodb"); const username = encodeURIComponent("admin"); const password = encodeURIComponent("mypassword"); const clusterUrl = "localhost:27017"; const authMechanism = "DEFAULT"; const uri = `mongodb://${username}:${password}@${clusterUrl}/?authMechanism=${authMechanism}`; const client = new MongoClient(uri, { useNewUrlParser: true, useUnifiedTopology: true }); try { await client.connect(); const database = client.db("nodebb"); const objects = database.collection("objects"); // get all user const query = { _key: /^user:\d+$/ }; // select fields we want to see const options = { projection: { _id: 0, username: true, _id: false, email: true, "email:confirmed": true, joindate: true, fullname: true }, }; const cursor = objects.find(query, options); if ((await cursor.count()) === 0) { console.log("No user found!"); } // iterate over the users await cursor.forEach(user => { if (user["email:confirmed"] == 1 ) { console.dir(user); } }); } finally { // make sure we close the connection await client.close(); } } // --------------------------------------------------- function init() { try { doMongoDb(); } catch(e) { console.log(e); } } // --------------------------------------------------- init();How do I delete a user?
-
Hi, thanks in advance for any help!
- Will 0.4.0 include a way to delete a user through the admin section?
- Is there a hack to achieve this now through the terminal? (Or am I missing something and there is already a way to do this?)
-
It will be in 0.4.0, follow along here https://github.com/designcreateplay/NodeBB/issues/746
-
I'm sure there's a way to delete a user using redis-cli, but that's not something I've attempted.
As for the ACP, it has not been implemented yet. However, the ability to delete a user is one of the features listed for NodeBB0.4.0 on GitHub. Let's just hope that it makes it. You may tack its progress here.
-
As for the ACP, it has not been implemented yet. However, the ability to delete a user is one of the features listed for NodeBB0.4.0 on GitHub. Let's just hope that it makes it. You may tack its progress here.
It's been completed. Check out the latest
git pull