Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Jason Kurian
    @JaKXz
    yay! :)
    also glad to see v2.0 published.
    @mathieudutour enabling gitter webhooks is a slight chore but pretty cool too :)
    Mathieu Dutour
    @mathieudutour
    will do when I have time. @JaKXz would you mind reviewing Automattic/monk#134, see if I have made any mistake? ;)
    Elad Nava
    @eladnava
    Hey guys, I just finished developing Monkster, a Node.js package that provides high availability for Monk. It implements smart error handling and retry logic to handle temporary network connectivity issues and replica set step-downs seamlessly. What do you think?
    Mathieu Dutour
    @mathieudutour
    Mathieu Dutour
    @mathieudutour

    I'm working on creating a proper documentation for monk. I experimented 2 approaches:

    I find the last approach better but I'd love to hear feedback from both

    Jason Kurian
    @JaKXz
    I'm a fan of gitbook personally
    Jason Kurian
    @JaKXz
    but, jsdoc -r lib/ -d docs/ does it in one line
    and there's plenty of good templates https://github.com/jsdoc3/jsdoc
    Jason Kurian
    @JaKXz
    @mathieudutour just curious, was Automattic/monk#64 implemented in v3?
    and Automattic/monk#43 can be solved by using findOneAndUpdate right?
    Jason Kurian
    @JaKXz
    @mathieudutour I also suggest enabling http://greenkeeper.io :)
    Mathieu Dutour
    @mathieudutour
    not, #64 is not implemented yet. #85 neither. Want to have a go?
    regarding #43, yes you can use findOneAndUpdate
    I don't really like save in general because it's not an atomic operation
    Mathieu Dutour
    @mathieudutour
    and what are your though about Automattic/monk#145 and Automattic/monk#143 ?
    (and I don't have to right to enable greenkeeper)
    Jason Kurian
    @JaKXz
    fair enough
    I'll make some comments :)
    can't promise to get to #64 or #85 anytime soon :(
    Ramanpreet N.
    @rsnara
    @mathieudutour, what was the reason for switching away from mongoskin in v3?
    Mathieu Dutour
    @mathieudutour
    @rsnara mongoskin is not maintained anymore and there have been discussion of deprecating it: https://github.com/kissjs/node-mongoskin/issues/107#issuecomment-188329836
    Ramanpreet N.
    @rsnara
    @mathieudutour cool, makes sense
    tstumm
    @tstumm
    Hi anyone here?
    Mathieu Dutour
    @mathieudutour
    yes?
    Godzsák Dávid
    @godzsa
    This message was deleted
    This message was deleted
    This message was deleted
    sfali23
    @sfali23

    What is best way to close the connection?

    I have a utility file which creates and execute query against mongo, problem is how to close connection properly. since API is promised based if the close method called at the of method then it doesn't return any thing since promised hasn't been completed, for example:

    var monk = require('monk');
    const db = monk('localhost/mydb');
    const users = db.get('users');
    user.find({}).then((data)=>{
       console.log(JSON.stringfy(data));
    });
    db.close();

    This doesn't print anything, because db connection get closed too soon.

    Any suggestion?

    Mathieu Dutour
    @mathieudutour
    var monk = require('monk');
    const db = monk('localhost/mydb');
    const users = db.get('users');
    user.find({}).then((data)=>{
       console.log(JSON.stringfy(data));
    }).then(() => db.close());
    ?
    Tim Berry
    @tim-berry
    users.find({}).each((user, {close, pause, resume}) => {
      // the users are streaming here
      // call `close()` to stop the stream
    }).then(() => {
      // stream is over
    })
    Is the .each a promise? If so what does it do?
    Alex
    @squishybanana04
    How can I create a database in a server using monk
    Gregor Plavčak
    @GregorPlavcak_twitter
    You can dynamicly set connection url: 'localhost:27017/test'. Database is automaticly created.
    Batyr Nuryyev
    @oneturkmen
    Anyone here?
    Just wanted to ask about queries and options. So, when I send query { username: "foo", email: "bbb@bbb.com" } , I want Monk to check if one the rows (entries) satisfy one or both of those query parameters (if the same username or same email exists, return promise) . But I did not find any specific for that purpose in the docs. How can I do that (basically, how can I implement OR operator with query params)? Thanks!
    Mathieu Dutour
    @mathieudutour
    hi @oneturkmen, that's not monk specific, you should check the mongodb docs. Something like this should work:
    {
        $or: [
            { username: "foo" },
            { email: "bbb@bbb.com}
        ]
    }
    Vinicius Camargo
    @viniciusCamargo
    Hmm I didn't know monk had a gitter room
    I'm just passing to say that monk is an awesome project :thumbsup:
    Andrej Rapoport
    @arapoport

    Hi!

    I have a small question about error handling. In my example I pass an invalid ID and this is not handled by the catch function, instead an exception is raised Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters:

    db.get('my').findOne({_id : "123"})
        .then(function(res){})
        .catch(function(err){
                console.log(err);
            });

    Shouldn't any kind of error be handled by the promise?

    Thanks!

    slovz7
    @slovz7
    Hi
    borut
    @borutkitak
    Hello. I'm having some troubles with aggregation. At my company we are using monk 0.9.0 and co-monk 1.0.0. The problem is that when I execute aggregation without cursor, mongo gives me error that cursor is required. Then when I add cursor nothing happens with function. I would appreciate if anybody can help me out.
    var t = yield new Promise(function(resolve, reject) {
          Companies.col.aggregate([
              { $match: { AdminId: "admin@example.com" }},
              { $lookup: { from: "Class", localField: "CompanyId", foreignField: "CompanyId", as: "Classes" }},
              { $unwind: "$Classes" },
              { $group: { _id: "$CompanyId", total: { $sum: { $size: { $ifNull: ["$Classes.History", []]} } } }}
            ], { cursor: { }},
            function(err, res) {
              if (!err){ 
                resolve(res);
              }
              else{
                reject(err);
              }
            });
          });
    Jack Durrant
    @jddurrant_gitlab
    Looking at Monk's release history on NPM, it hasn't had a new release for 10 months, previously receiving an update every couple of months or so. Is this project still active?