Skip to content
  • 0 Votes
    2 Posts
    205 Views
    julianJ

    MongoDB is the recommended data store.

    For development I use redis because it is just easier for me to use (e.g. zrange sortedSet 0 -1 vs db.objects.find({ _key: "sortedSet" }).pretty();)

    All three are supported by the NodeBB team πŸ˜„

  • 0 Votes
    4 Posts
    626 Views
    julianJ

    @sinisterspatula Probably, yes.

    The thing is, we don't interface with MongoDB directly. We use an abstraction layer, and so if your database of choice supports all of the commands we throw at it (you can see the abstraction layer methods in src/database/*), then NodeBB can theoretically support it.

  • 0 Votes
    7 Posts
    1k Views
    Daniel Mendoza PupoD

    @julian I tried that route, and it still didn't work:
    -rw-r--r--. 1 redis redis 63122 Mar 6 13:56 /path/to/redis/redis.conf
    redis.service: (changed the path to my redis.conf)
    ExecStart=/usr/bin/redis-server /path/to/redis/redis.conf --supervised systems

    After changing the redis service file:
    systemctl daemon-reload
    systemctl start/restart redis
    ● redis.service - Redis persistent key-value database
    Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)
    Drop-In: /etc/systemd/system/redis.service.d
    └─limit.conf
    Active: failed (Result: exit-code) since Thu 2024-03-07 16:18:06 EST; 7s ago
    Process: 3672598 ExecStop=/usr/libexec/redis-shutdown (code=exited, status=0/SUCCESS)
    Process: 3672869 ExecStart=/usr/bin/redis-server /path/to/redis/redis.conf --supervised systemd (code=exited, status=1/FAILURE)
    Main PID: 3672869 (code=exited, status=1/FAILURE)

    Mar 07 16:18:06 my-lab systemd[1]: Starting Redis persistent key-value database...
    Mar 07 16:18:06 my-lab redis-server[3672869]: 3672869:C 07 Mar 2024 16:18:06.355 # Fatal error, can't open config file '/path/to/redis/redis.conf'
    Mar 07 16:18:06 my-lab systemd[1]: redis.service: Main process exited, code=exited, status=1/FAILURE
    Mar 07 16:18:06 my-lab systemd[1]: redis.service: Failed with result 'exit-code'.
    Mar 07 16:18:06 my-lab systemd[1]: Failed to start Redis persistent key-value database.

  • 3 Votes
    6 Posts
    906 Views
    JΓΌrgenJ

    It finally showed up - but that definitely took a quite a while. Maybe I was fooled by cached content?

  • 1 Votes
    3 Posts
    506 Views
    NoduleJSN

    @baris yeah it's true, but you can use transaction on a multicluster with only one node, also if with a lot of limitations.
    About your command example is a good idea also if it would work only with redis and postgre, with mongodb can be used like a normal batch.

    I took a look to postgreSQL module, seems it support transactions, mongodb emulate the same thing with non ACID batch. I prefer to avoid SQL databases but the way data is organized seem more suitable to a relational DB

  • 1 Votes
    9 Posts
    2k Views
    F

    @scottalanmiller So unfortunately none of the versions worked with our database any more. We even tried 1.11.2 and went back to 1.10.2 on mongodb 3.2 as well.

    Now, we've updated mongodb to 3.4 and picked up an old database backup to migrate from 3.2 to 3.4 on the latest nodebb (1.11.2). Its working properly now.

    However, a warning for people on older versions of mongodb when updating to 1.11.x onward.

  • 0 Votes
    5 Posts
    2k Views
    T

    Minor FYI....Elasticsearch has made a strong stand that they are not a database. There are certain levels of consistency and reliability to qualify as a database that they have said they cannot support. But if your data isn't critical, and you don't mind a noticeable a delay between when you write a document and when it available for reading, then that's fine. πŸ™‚

  • 0 Votes
    8 Posts
    3k Views
    A

    @esteban-constante I'm not too good in js and am trying to plug in angular as frontend and use nodebb api for integrating with one of our existing applications. But angular scopes are not recognized in nodebb. Can you please suggest me some links/posts to get started with nodebb development? I'm not able to understand the flow of the application.

  • 0 Votes
    2 Posts
    2k Views
    Pramvir RatheeP

    Found the solution, importing too much topics in a single category hangs the nodebb, import some data than move it to some temporary category. Thasn import remaining data, meanwhile delete mongodb import Garbaze in using these mongo commands

    db.objects.update({},{$unset: {_imported_tid:1}},{multi: true}); db.objects.update({},{$unset: {_imported_uid:1}},{multi: true}); db.objects.update({},{$unset: {_imported_cid:1}},{multi: true}); db.objects.update({},{$unset: {_imported_slug:1}},{multi: true}); db.objects.update({},{$unset: {_imported_locked:1}},{multi: true}); db.objects.update({},{$unset: {_imported_path:1}},{multi: true}); db.objects.update({},{$unset: {_imported_title:1}},{multi: true}); db.objects.update({},{$unset: {_imported_content:1}},{multi: true}); db.objects.update({},{$unset: {_imported_guest:1}},{multi: true}); db.objects.update({},{$unset: {_imported_ip:1}},{multi: true}); db.objects.update({},{$unset: {_imported_user_slug:1}},{multi: true}); db.objects.update({},{$unset: {_imported_user_path:1}},{multi: true}); db.objects.update({},{$unset: {_imported_category_path:1}},{multi: true}); db.objects.update({},{$unset: {_imported_category_slug:1}},{multi: true});

    But keep in mind this will also delete the history of import will result in duplicate categories get imported or the posts, to prevent this keep writing post ids and category ids which you imported and delete them from the old database.

  • 0 Votes
    72 Posts
    33k Views
    Charly86C

    I had back this problem a 2nd time 2 days ago, I don't know if it's related but I was doing iptables FW settings on the VM, I had nodeBB running, and also redis and from my computer desktop redis desktop manager connected to DB.
    Then I made a mistake in iptables, blocked all redis port (even local), saying nodebb unable to connect to redis (so as redis desktop manager) then when I openned back 6379 port, all data was gone, not sure if it's related, just an information.

  • 0 Votes
    1 Posts
    1k Views
    FidelixF

    First of all, I'm new to NodeJS development. I'm liking it so far (except for a few annoyances here and there).

    I am extending development of nodebb-plugin-import-ipboard (forked and will send a PR once it's done) to support a bunch of stuff the current plugin does not currently support, for instance:

    IPB replies which are in a special blockquote format. Spoiler blocks Mentions A few more things...

    On my nodebb-plugin-import-ipboard/index.js file, which I'm requiring from a manual test.js file (so it's not running inside NodeBB!), I placed a:
    var db = require('nodebb-plugin-import/server/db');

    But when I try to use it like this:
    var imported_post = db.getObject("_imported_post:1566");
    I just get "undefined".
    I can see on the debugger variables Redis is loaded (but I don't know if it was loaded correctly.)

    I also tried loading data instead of db:
    var data = require('nodebb-plugin-import/server/data');
    and
    var imported_post = data.getImportedPost("1566");

    And I just get undefined.
    Can someone tell me what I'm doing wrong?

  • 0 Votes
    1 Posts
    1k Views
    FidelixF

    First of all, I'm new to NodeJS development. I'm liking it so far (except for a few annoyances here and there).

    I am extending development of nodebb-plugin-import-ipboard (forked and will send a PR once it's done) to support a bunch of stuff the current plugin does not currently support, for instance:

    IPB replies which are in a special blockquote format. Spoiler blocks Mentions A few more things...

    On my nodebb-plugin-import-ipboard/index.js file, which I'm requiring from a manual test.js file (so it's not running inside NodeBB!), I placed a:
    var db = require('nodebb-plugin-import/server/db');

    But when I try to use it like this:
    var imported_post = db.getObject("_imported_post:1566");
    I just get "undefined".
    I can see on the debugger variables Redis is loaded (but I don't know if it was loaded correctly.)

    I also tried loading data instead of db:
    var data = require('nodebb-plugin-import/server/data');
    and
    var imported_post = data.getImportedPost("1566");

    And I just get undefined.
    Can someone tell me what I'm doing wrong?

  • 0 Votes
    2 Posts
    2k Views
    Master-AntonioM

    Update 16: 18 : I removed nodebb-plugin-poll and Seems to me that returned all right.
    @Schamper
    For me is this.

  • 0 Votes
    1 Posts
    1k Views
    T

    Hi,

    I've been working on migrating an existing forum to nodebb and have the last steps left.
    I did a working test import and everything looks good.
    We are running NodeBB 0.6.1 on Mongo

    Now I would like to empty the database from users and discussions, while keeping all the settings I've made. The ACP is not an option, as there are quite a lot of users and discussions.

    Is there a simple way to do this?

  • 0 Votes
    4 Posts
    3k Views
    A

    I am writing like plug-in, which provides an like functionality for anonymous as well as registered user.
    1. Anonymous User should be able to like on any comment/reply and I have to restrict anonymous user via IP address.
    Yet, I can store IP values to redis database, I need to find out, The given IP value is present in "like:pid" hash set.
    I need to write query structure which finds out the given anonymous users IP address is not present in database for that particular post.

    Thanks!!

  • MongoDB 3.0

    General Discussion
    3
    2 Votes
    3 Posts
    2k Views
    S

    Awesome, looking forward to that. Even more performance from the current architecture!! Love to see that. Although even now, the site screams.

  • 1 Votes
    2 Posts
    2k Views
    ShardS

    ObjectRocket is pretty keen as well.

  • 0 Votes
    2 Posts
    2k Views
    barisB

    You need to write a server side script to go through all the users and update their urls.

    Something like the following should work.

    var db = require('./database'), user = require('./user'), async = require('async'); db.getSortedSetRange('users:joindate', 0, -1, function(err, uids) { async.eachLimit(uids, 50, updateUserImage, function(err) { console.log('done'); }); }); function updateUserImage(uid, next) { user.getUserFields(uid, ['image', 'gravatarpicture', 'uploadedpicture'], function(err, userData) { // do your update here, can check current data from userData user.setUserField(uid, 'gravatarpicture', 'some_new_url', next); }); }
  • 0 Votes
    3 Posts
    2k Views
    barisB

    @lpeachl said:

    getSortedSetRangeWithScores
    getSortedSetRangeByScoreWithScores

    Added in https://github.com/NodeBB/NodeBB/commit/1fe82ee45207fe82671d9e8f43ac74309e4586bd

  • 0 Votes
    27 Posts
    10k Views
    A

    @Alex said:

    I will edit the plugins locally then until the plugins's authors put the modification. Thank you @julian for this quick fix. @a_5mith could you let us know when you have pushed it to npm or github please? πŸ˜‰

    Yeah sure.