mongoDB install



  • Just converting my redis nodebb 0.4.2 over to mongo (2.6.1) under ubuntu... Following the instructions on wiki and going through setup again, but this time using mongo....

    Here is the error:

    Failed to load c++ bson extension, using pure JS version
    Failed to load c++ bson extension, using pure JS version
    info: Populating database with default configs, if not already set...
    error: Error creating index not authorized for query on nodebb.system.indexes
    error: Error creating index not authorized for query on nodebb.system.indexes
    error: Error creating index not authorized for query on nodebb.system.indexes
    error: name=MongoError
    warn: NodeBB Setup Aborted. not authorized for query on nodebb.objects

    I've setup mongo with auth as required (and verified its working...) gave the role "userAdmin"

    Please help.



  • So the current mongo guide on the wiki is a bit off... and I was able to get the install working up until another issue with the default theme... but more on that in a different bug report.

    Authentication worked, but mongo was not letting the user nodebb do anything. This lead me to researching the role 'userAdmin' and I discovered a few things...

    • For 'userAdmin' or 'userAdminAnyDatabase' roles to work, you need to have an admin database where these roles should be defined. These roles should ultimately be reserved for administrative users, not a service like nodebb. Also defining these inside another database will have no effect. (which is pretty much what broke the install)
    • the role "readWrite" is sufficient for nodebb service. It is also the most secure default role available for a connecting service such as nodebb.
    • the wiki assumes the mongo is being installed for the first time. New installs should include the addition of an administrative user under the admin database, otherwise once auth is on, mongo is locked down and would have to be unlocked again for any further administrative work.
    • the wiki is also using depreciated commands. addUser is now createUser

    Here are the commands I ran after installing mongo:

    (mongo shell)
    use admin;
    db.createUser({ user: "mongoadmin", pwd: "password", roles: ["userAdminAnyDatabase"] });
    use nodebb;
    db.createUser({ user: "nodebbsvc", pwd: "password", roles: ["readWrite"] });
    exit;

    then edit /etc/mongo.conf and uncomment "auth=true"

    restart mongo service (service mongod restart)

    You can test the authentication by loading the mongo shell and typing the following command:

    use nodebb;
    db.auth('nodebbsvc','password');

    It should return a '1';

    I hope this helps anyone else having issues with mongo and nodebb.



  • Yus! This worked,** thank you so much!!** ❤ ❤

    I've been smashing my head against a wall over this for weeks since MongoDB 2.6 was released!!


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.