These are chat archives for Automattic/mongoose

12th
Aug 2015
Maksim
@chetverikov
Aug 12 2015 01:36
@fayimora Very strange… if you call document.toObject?
Maksim
@chetverikov
Aug 12 2015 02:10
@devey So... it will be more correct:
List.findById(id, function(err, list){
  if (err)
    return res.send(err); // need to do return!

  List.find({_id: {$in: list.items}}, function(err, items){
    list.items = items;

    res.json({list: list});
  });
});

// or with populate

List.findById(id).populate('items').exec(function(err, list){
  if (err)
    return res.send(err); // need to do return!

  res.json({list: list});
});
Julien Sansot
@Kalagan
Aug 12 2015 08:50
hi
When I use mongoose.connect in my script, my script never exits
Julien Sansot
@Kalagan
Aug 12 2015 09:30
so apparently that's because i forgot to put mongoose.disconnect(); at the end
Fayi Femi-Balogun
@fayimora
Aug 12 2015 09:48
@chetverikov yeah i tried something like delivery.toObject().customer and that didn’t work.
Yassine Sania
@devey
Aug 12 2015 12:24
@chetverikov ty, yes i did something like the first part but that 'list.items = items' doesn't work so i had to through all the data and save one by one 'list.items[i] = items[i];'
list.items[i] = items[i];