Skip to content

NodeBB Mess / Mongo DB

Solved Configure
  • Hi,

    Basically my nodebb installation I felt was a mess…Nothing was installing and so I decided to make a clean install. I thought that i had cleared mongodb but i am now thinking not properly.

    I ran use nodebb and then db.dropDatabase(); I had problems deleting the user nodebb also.

    Anyway I tried to reinstall but all traces of the old install was still there on the page. Not the browser as cleared all and tried others. Tried upgrading it but nothing was happening…all a mess 👎

    I am here. Deleted the nodebb folder and then tried again to db.dropDatabase(); in mongo. But i do that and get success but when i run show dbs nodebb is still there. 0.00 in it but still there. Is it traces of that db that is messing with the page? Showing parts of the old stuff? I cannot delete that mongo db. Do i have to delete user too? Don’t think that would matter but the db for sure i guess?

    Thanks guys.

  • @phenomlab Hi, yes i selected the db first.

    I have software also on the GUI that can delete and drop the db. A few seconds later when i refresh the db is back again.

    I tried all again and on ./nodebb setup it gets worse. I created the user again (with admin) Only thing i cannot start fresh is the db itself.

    2022-08-18T15:56:38.659Z [3984] - warn: NodeBB Setup Aborted.
     MongoServerError: Authentication failed.
        at Connection.onMessage (/home/smiley/nodebb/node_modules/mongodb/lib/cmap/connection.js:210:30)
        at MessageStream.<anonymous> (/home/smiley/nodebb/node_modules/mongodb/lib/cmap/connection.js:63:60)
        at MessageStream.emit (events.js:375:28)
        at processIncomingData (/home/smiley/nodebb/node_modules/mongodb/lib/cmap/message_stream.js:132:20)
        at MessageStream._write (/home/smiley/nodebb/node_modules/mongodb/lib/cmap/message_stream.js:33:9)
        at writeOrBuffer (internal/streams/writable.js:358:12)
        at MessageStream.Writable.write (internal/streams/writable.js:303:10)
        at Socket.ondata (internal/streams/readable.js:726:22)
        at Socket.emit (events.js:375:28)
        at addChunk (internal/streams/readable.js:290:12)
    

    I have nothing there so destroying it all and starting again is no problem but I need to remove all traces and from mongo too.

    ####QUICK UPDATE### I just rebooted my machine and have managed to dlete the db and the user…I will try and install again and see if i get this error.

  • @Sampo2910 Did you do it via the below method ? If you didn’t select a database first, then the drop doesn’t normally succeed.

    > use nodebb; 
    > db.dropDatabase();
    
  • @phenomlab Hi, yes i selected the db first.

    I have software also on the GUI that can delete and drop the db. A few seconds later when i refresh the db is back again.

    I tried all again and on ./nodebb setup it gets worse. I created the user again (with admin) Only thing i cannot start fresh is the db itself.

    2022-08-18T15:56:38.659Z [3984] - warn: NodeBB Setup Aborted.
     MongoServerError: Authentication failed.
        at Connection.onMessage (/home/smiley/nodebb/node_modules/mongodb/lib/cmap/connection.js:210:30)
        at MessageStream.<anonymous> (/home/smiley/nodebb/node_modules/mongodb/lib/cmap/connection.js:63:60)
        at MessageStream.emit (events.js:375:28)
        at processIncomingData (/home/smiley/nodebb/node_modules/mongodb/lib/cmap/message_stream.js:132:20)
        at MessageStream._write (/home/smiley/nodebb/node_modules/mongodb/lib/cmap/message_stream.js:33:9)
        at writeOrBuffer (internal/streams/writable.js:358:12)
        at MessageStream.Writable.write (internal/streams/writable.js:303:10)
        at Socket.ondata (internal/streams/readable.js:726:22)
        at Socket.emit (events.js:375:28)
        at addChunk (internal/streams/readable.js:290:12)
    

    I have nothing there so destroying it all and starting again is no problem but I need to remove all traces and from mongo too.

    ####QUICK UPDATE### I just rebooted my machine and have managed to dlete the db and the user…I will try and install again and see if i get this error.

  • Well no idea…after rebooting machine several times and several times of doing the same thing…( at least I think it was lol 🙂 ) Here w are again.

    Fell free to purge this post as it serves no purpose other than reminding of my own mistakes haha… Sorry for the fuss but really dont know what happened.

    2022-08-18 19_21_51-Home _ NodeBB.png

  • @Sampo2910 That looks like an authentication issue - is the password correct - can you provide the command you used to create the database ?

    Should be something like

    db.createUser( { user: "sudonixtest", pwd: "lkjklj9995485469dffgkjk-201x", roles: [ { role: "readWrite", db: "sudonixtest" }, { role: "clusterMonitor", db: "admin" } ] } )
    

    m

  • @Sampo2910 said in NodeBB Mess / Mongo DB:

    ####QUICK UPDATE### I just rebooted my machine and have managed to dlete the db and the user…I will try and install again and see if i get this error.

    🙂 That sounds like a database deadlock. If you have records in use, then of course, the drop will fail unless it’s forced.

    Glad to hear it’s sorted.

  • @phenomlab What amazes me and this is pretty much everytime with NodeBB haha. The VERY FIRST THING I try to do…Just makes me feel stupid. Surely this cant be just me haha.

    2022-08-18 19_40_07-Extend _ Plugins _ NodeBB Admin Control Panel.png

  • @Sampo2910 🙂 You’ll get that error if the .json file isn’t updated for latest release compliance - but you can still install from the CLI by using npm install nodebb-plugin-whateveritis

  • phenomlabundefined phenomlab has marked this topic as solved on

Did this solution help you?
Did you find the suggested solution useful? Why not buy me a coffee? It's a nice gesture, and a great way to show your appreciation 💗

  • WP / Woocommerce Mystery

    Solved Configure
    23
    12 Votes
    23 Posts
    940 Views

    @Panda said in WP / Woocommerce Mystery:

    Just back to my other question, have you ever used Shopify?
    It insists on a templating language to use any custom js.

    Not personally as never had any need, however, I do know that it uses Liquid for JS templating. It’s written in Ruby and is used to generate dynamic content on shop fronts. There’s zero reason as to why it wouldn’t work with data supplied by 3rd party API’s, although WordPress code won’t natively work for obvious reasons, and as such, this code would need to be re-written.

    The JS part will likely work with minor modification, but not the PHP file in it’s current form.

  • 4 Votes
    8 Posts
    322 Views

    @Panda said in Upgrade to NodeBB v3? 2BB or not 2BB, that is the question!:

    So although thats a plugin it has Widget like element and stopped working on the Theme change

    Which is normal based on the widgets being reset when you change themes.

  • 5 Votes
    13 Posts
    485 Views
    'use strict'; const winston = require('winston'); const user = require('../user'); const notifications = require('../notifications'); const sockets = require('../socket.io'); const plugins = require('../plugins'); const meta = require('../meta'); module.exports = function (Messaging) { Messaging.notifyQueue = {}; // Only used to notify a user of a new chat message, see Messaging.notifyUser Messaging.notifyUsersInRoom = async (fromUid, roomId, messageObj) => { let uids = await Messaging.getUidsInRoom(roomId, 0, -1); uids = await user.blocks.filterUids(fromUid, uids); let data = { roomId: roomId, fromUid: fromUid, message: messageObj, uids: uids, }; data = await plugins.hooks.fire('filter:messaging.notify', data); if (!data || !data.uids || !data.uids.length) { return; } uids = data.uids; uids.forEach((uid) => { data.self = parseInt(uid, 10) === parseInt(fromUid, 10) ? 1 : 0; Messaging.pushUnreadCount(uid); sockets.in(`uid_${uid}`).emit('event:chats.receive', data); }); if (messageObj.system) { return; } // Delayed notifications let queueObj = Messaging.notifyQueue[`${fromUid}:${roomId}`]; if (queueObj) { queueObj.message.content += `\n${messageObj.content}`; clearTimeout(queueObj.timeout); } else { queueObj = { message: messageObj, }; Messaging.notifyQueue[`${fromUid}:${roomId}`] = queueObj; } queueObj.timeout = setTimeout(async () => { try { await sendNotifications(fromUid, uids, roomId, queueObj.message); } catch (err) { winston.error(`[messaging/notifications] Unabled to send notification\n${err.stack}`); } }, meta.config.notificationSendDelay * 1000); }; async function sendNotifications(fromuid, uids, roomId, messageObj) { const isOnline = await user.isOnline(uids); uids = uids.filter((uid, index) => !isOnline[index] && parseInt(fromuid, 10) !== parseInt(uid, 10)); if (!uids.length) { return; } if (roomId != 11) { // 5 Is the ID of the ID of the global chat room. Messaging.getUidsInRoom(roomId, 0, -1); // Proceed as normal. } else { user.getUidsFromSet('users:online', 0, -1); // Only notify online users. } const { displayname } = messageObj.fromUser; const isGroupChat = await Messaging.isGroupChat(roomId); const notification = await notifications.create({ type: isGroupChat ? 'new-group-chat' : 'new-chat', subject: `[[email:notif.chat.subject, ${displayname}]]`, bodyShort: `[[notifications:new_message_from, ${displayname}]]`, bodyLong: messageObj.content, nid: `chat_${fromuid}_${roomId}`, from: fromuid, path: `/chats/${messageObj.roomId}`, }); delete Messaging.notifyQueue[`${fromuid}:${roomId}`]; notifications.push(notification, uids); } };
  • Viewing Permission.

    Solved General
    33
    12 Votes
    33 Posts
    2k Views

    @phenomlab

    Ah Mark you are a star. Thank you very much. I just logged on and seen someone had worked their magic 🙂

    Again it is very much appreciated.

  • nodebb dropdown menu

    Solved Configure
    5
    0 Votes
    5 Posts
    426 Views

    @phenomlab said in nodebb dropdown menu:

    @kurulumu-net You set it like the below example taken from this site

    aae36790-3257-4bb2-ad5a-0d744309876a-image.png

    Which presents this

    77f47260-2941-4afe-9614-8e17dcfc8c19-image.png

    Very interesting…

    I actually thought this wasn’t possible, as I remember it being asked in the NodeBB forum.

    Is this something new that’s been implemented? I’ll 100% be doing that when I’m on the laptop over the weekend.

  • Iframely (Nodebb)

    Solved Configure
    40
    4 Votes
    40 Posts
    2k Views

    @DownPW This is now resolved. The issue was an incorrect URL specified in the Nodebb plugin. I’ve corrected this, and now it works as intended.

  • 18 Votes
    36 Posts
    2k Views

    you are too fast 😉

  • 3 Votes
    4 Posts
    438 Views

    @cagatay same here. Was previously an IONOS user, but moved to Hetzner to realise both savings and performance increase and have never looked back.