Is it safe to remove socket.io collection from database

General Discussion

Suggested Topics


  • 1 Votes
    3 Posts
    275 Views
    ACP>admin/manage/privileges

    May prove illuminating? I'm not on latest nodebb but think you can restrict guests to uploading photos. I don't note any knobs for up/down voting though. Hmmm..... Maybe in more recent versions? 🤔

    Be all that as it may, have you thought this through?

  • 1 Votes
    1 Posts
    174 Views

    I'll soon be creating a custom theme and some plugins for a forum that is already in use and I'm thinking about running second instance on beta.forum.url with the new theme and plugins enabled when it's close to being ready (but in need of testing), that I'd like to work with the same database as the main forum - so that users can just use beta if they want to preview new features while still using the same forum as others.

    Now, I know that the list of themes/plugins enabled is stored in database, so I'd probably need to do something about that, but is there anything else that would stop me from running two instances with a bit different configs off one database? Some sync issue with posts/topics or something like that?

    EDIT: actually, since I might as well help others, would it be a good idea to add an option to add some instance identifier to db plugin entries to core? Perhaps in config.json? So that if it's set NodeBB would look for plugins:<instance>:active for example.

  • 0 Votes
    1 Posts
    319 Views

    Hi,

    Brief details of what is required:

    I have index.html page and index.js file under router. I am showing data from one collection say 'x' on page index.html. All the code related to router.get/post is done in index.js file.

    There is a button 'SubText' on index.html, m applying aggregation for search and storing output in new collection. Till here, everything is working fine.

    Now my requirement is when user clicks on 'SubText' button, after new collection, it should take it to different html page and show data from newly created collection.

    Please can anybody suggest/guide how to do this?

    Please find below the coder:

    Index.js

    var createGroups = function (db, callback) { var pipeline = [ { $match: { $text: { $search: "Error" } } }, {

    $project: { _id: 0, procPath: 1, bkgroundInfo: 1, "result": { $cond: { if: { $gte: [{ $indexOfCP: ["$bkgroundInfo", "Error"] }, 0] }, then: { $substrCP: ["$bkgroundInfo", { $indexOfCP: ["$bkgroundInfo", "Error"] }, 140] }, else: "Not Found" } } } }, { "$out": "SKSNodeColl" }

    ]
    db.aggregate(pipeline).toArray(function (err, result) {
    //assert.equal(err, null);
    console.log(result);
    callback(result);
    });
    };

    router.get('/newColl', function (req, res, next) { MongoClient.connect(url, { useNewUrlParser: true }, function (err, client) { if (err) { console.log(err); throw err; } var db = client.db("mydb"); var collection = db.collection("Users"); console.log("Mongo Connection - New Collection"); createGroups(collection, function (err, result) { console.log("newCollection Created"); var userdetails = path.join(__dirname, "/../views/userdetails.html"); console.log(userdetails); client.close();
    res.sendFile(userdetails);
    }); });
    });

    =====================
    Index.html

    <a href="/newColl"><input type="button" id="resultMatch" value="PatternMatchingResult" tabindex="1"></a>

    userdetails.html //page where I want to show data from new collection.(included ptrnSearch.js in this file in head section: )

    <form id="form1" name="form1" method="post" action="/fetch">
    <input type="hidden" name="id" value="" id="id" />
    <table border="1">
    <tbody>
    <tr>
    <th> ID </th>
    <th> Procedure Path </th>
    <th> Background Description </th>
    <th> Error Pattern </th>
    </tr>
    {% if (data.length) %}
    {% for item in data %}
    <tr>
    <td> {{item['_id']}} </td>
    <td> {{item['procPath']}} </td>
    <td> {{item['bkgroundInfo']}} </td>
    <td> {{item['result']}} </td>
    </tr>
    {% endfor %}
    {% endif %}
    </tbody>
    </table>
    </form>

    ptrnSearch.js //added to userdetails.html page

    router.get('/', function (req, res) { MongoClient.connect(url, function (err, client) { if (err) { throw err; } var db = client.db("mydb"); db.collection('SKSNodeColl').find({}).toArray(function (err, docs) { if (err) { throw err; } res.render('userdetails.html', { data: docs }); client.close(); }); }); });

    ==============================
    Many Thanks

  • NodeBB on Sandstorm.io

    General Discussion
  • Remove bump topic

    General Discussion
    0 Votes
    1 Posts
    589 Views

    Hello. Where can i remove bump topic? I need to after add the post a topic is not raised.