These are chat archives for Automattic/mongoose

25th
Apr 2016
Bhanu Priya Vijayaraj
@bhanuV
Apr 25 2016 13:26
Hello, Can we sort three collections by createdAt attribute? Thanks.
Christoph Werner
@codepunkt
Apr 25 2016 13:52
@vladotesanovic yes, i know. that doesn't answer my question, though. why can i call model constructor without parameters, defaulting to {}, but not call create without parameters, defaulting to {}
Vlado Tesanovic
@vladotesanovic
Apr 25 2016 13:52
@gonsfx it is not model constructor
Vlado Tesanovic
@vladotesanovic
Apr 25 2016 14:32
@Nepoxx winstonjs/winston#579 what happen to this? Did they added it?
Pier-Luc Gagnon
@Nepoxx
Apr 25 2016 14:33
I don't know, that was a year ago, back then I only created the output directory using mkdirp
Vlado Tesanovic
@vladotesanovic
Apr 25 2016 14:41
ah, don't like that, i will try with rotation
oodboo
@oodboo
Apr 25 2016 19:53
This message was deleted
This message was deleted
Hi guys, can anyone help me to convert following code to from shell MongoDB to mongoose ?
db.getCollection('users').aggregate( [
{ 
    $group: { _id: {
                     sid: "$siteid",  
                     link: "$link"
                   }, 
            count: { $sum: 1 } 
          } 
}]).forEach(function(obj){ 
  var site = db.sites.findOne({uuid:obj._id.sid});
  obj._id.link = site.sitename + " - " + obj._id.link;
  print(obj);
});
LeonineKing1199
@LeonineKing1199
Apr 25 2016 20:10
  1. Download Mongoose
  2. Set-up Mongoose to connect to your db
  3. Use Mongoose's aggregate stuff
  4. Profit