Skip to content

Nodebb: failed to restore a mongo dump

Solved Configure
  • hello @phenomlab

    i want to restore my production db mongo backup to my dev environnement

    I have set the same ID/password for mongo admin users, same user for same database name and same password.

    Hhere is the file of the dump

    root@nodebbpwclonedb:/home/nodebb/nodebb_DB_20230107/nodebb# ls -lsah
    total 1,6G
    4,0K drwxr-xr-x 2 nodebb nodebb 4,0K  7 janv. 23:09 .
    4,0K drwxr-xr-x 3 nodebb nodebb 4,0K  7 janv. 23:08 ..
    1,5G -rw-r--r-- 1 nodebb nodebb 1,5G  7 janv. 03:30 objects.bson
    4,0K -rw-r--r-- 1 nodebb nodebb  603  7 janv. 03:30 objects.metadata.json
     18M -rw-r--r-- 1 nodebb nodebb  18M  7 janv. 03:30 searchpost.bson
    4,0K -rw-r--r-- 1 nodebb nodebb  492  7 janv. 03:30 searchpost.metadata.json
    276K -rw-r--r-- 1 nodebb nodebb 275K  7 janv. 03:30 searchtopic.bson
    4,0K -rw-r--r-- 1 nodebb nodebb  493  7 janv. 03:30 searchtopic.metadata.json
       0 -rw-r--r-- 1 nodebb nodebb    0  7 janv. 03:30 sessions.bson
    4,0K -rw-r--r-- 1 nodebb nodebb  314  7 janv. 03:30 sessions.metadata.json
    

    and the command I use for restore with the result :

    nodebb@nodebbpwclonedb:~/nodebb$ sudo mongorestore --username admin --password XXXXXXXXXXXXXXX --nsInclude nodebb.objects --drop /home/nodebb/nodebb_DB_20230107/nodebb/
    [sudo] Mot de passe de nodebb : 
    2023-01-07T23:14:07.617+0100    preparing collections to restore from
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/objects.bson", skipping...
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/objects.metadata.json", skipping...
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/searchpost.bson", skipping...
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/searchpost.metadata.json", skipping...
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/searchtopic.bson", skipping...
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/searchtopic.metadata.json", skipping...
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/sessions.bson", skipping...
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/sessions.metadata.json", skipping...
    2023-01-07T23:14:07.617+0100    0 document(s) restored successfully. 0 document(s) failed to restore.
    

    grrrrrrr

  • @phenomlab

    In fact I specified the sub rep and not the rep

    DON’T DO THIS:

    nodebb@nodebbpwclonedb:~/nodebb$ sudo mongorestore --username admin --password XXXXXXXXXXXXXX --nsInclude nodebb.objects --drop /home/nodebb/nodebb_DB_20230107/nodebb/
    

    BUT THIS :

    nodebb@nodebbpwclonedb:~/nodebb$ sudo mongorestore --username admin --password XXXXXXXXXXXXXX --nsInclude nodebb.objects --drop /home/nodebb/nodebb_DB_20230107/
    

    🙂

  • DownPWundefined DownPW 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 💗

  • 13 Votes
    27 Posts
    2k Views

    yuuuuu.png

  • 2 Votes
    11 Posts
    320 Views

    @veronikya said in mongodb replica set:

    The host’s local dns resolution is not configured. The problem of the host’s hosts being unable to be resolved in docker has been solved. Surprisingly
    Solution:
    Edit the /etc/resovel.conf file
    Add 127.0.0.53

    One immediate issue I can think of here is that editing resolv.conf directly is no longer supported and not recommended (because the changes do not survive a reboot) - unless you install the resolvconf package?

  • Fixed background to nodebb forum

    Solved Configure
    25
    4 Votes
    25 Posts
    1k Views

    @Panda said in Fixed background to nodebb forum:

    Chatgpt told me the ::before method.

    Go figure 😛

  • 5 Votes
    13 Posts
    489 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); } };
  • 2 Votes
    19 Posts
    579 Views

    @phenomlab Work now 😉

  • MailGun Not Working NodeBB

    Solved Configure
    6
    1 Votes
    6 Posts
    246 Views

    @phenomlab did it 🙂 i did not create smtp user on mailgun. everything is working now.

    6cc6061f-ed5d-41f6-8eb7-5d98f98b3706-image.png

  • NodeBB Mess / Mongo DB

    Solved Configure
    8
    4 Votes
    8 Posts
    337 Views

    @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

  • 1 Votes
    1 Posts
    626 Views
    No one has replied