These are chat archives for Automattic/mongoose

Jan 2017
Jackson Delahunt
Jan 13 2017 01:40
generally, how many milliseconds does a replica set election take to reach consensus and the new master handling writes? assuming ~1-2ms network latency
Erinç Fırtına
Jan 13 2017 07:57
@sabrehagen it depends on your replica set config
Michael Lynn
Jan 13 2017 08:00
New versions of MongoDB (3.2+) leverage the RAFT Protocol... this resulted in dramatically improved failover timings... Pre- 3.2 could have been in increments of 30 seconds... whereas 3.2 could be as low as 2 seconds - depending on your specific configuration.
Alex Munoz
Jan 13 2017 13:40
how finish mongoose connection after insert some elements?
Joseph Chambers
Jan 13 2017 22:31

Hello, I have a question. I have here: that a gift belongs to a user. However, Im trying to save a user can have many gifts. Here is my user model:

When I create a new gift:

// Create a Gift
  (req, res, next) => {

    // get data from form and add to gift array.
    let user = req.body.user,
      giftNumber = req.body.giftNumber,
      date =,
      giftDescription = req.body.giftDescription,
      giftAmount = req.body.giftAmount,
      giftCode = req.body.giftCode,
      redeemCode = req.body.redeemCode,
      passCode = req.body.passCode,
      senderFirstName = req.body.senderFirstName,
      senderLastName = req.body.senderLastName,
      giftMessage = req.body.giftMessage,
      newGift = {
        user: user,
        giftNumber: giftNumber,
        date: date,
        giftDescription: giftDescription,
        giftAmount: giftAmount,
        giftCode: giftCode,
        redeemCode: redeemCode,
        passCode: passCode,
        senderFirstName: senderFirstName,
        senderLastName: senderLastName,
        giftMessage: giftMessage

      .create(newGift, (err, newlyCreated) => {
        if (err) {
          req.flash('error', err.message);


what I see in the database for the user when I create a new gift: "gifts" : [], it's empty. What am I doing wrong?