What is the behavior when Mongodb reaches the defined maximum value of $inc?

Asked

Viewed 46 times

0

What is the behavior when Mongo reaches its maximum value for findAndModify with parameters below, how can I restart to 0 when this happens?

        db.collection('count').findAndModify(
        { "_id": "xy" },
        [["_id", 1]],
        { $inc: { seq: 1 } },
        {new: true, 'upsert': true},
    function(err,doc) {
        if (err) throw err;
        console.log(doc.value.seq);
  }
  • Welcome to Stack Overflow in English. This Question appears to be in English and this is the SO Portuguese community. If you’re Looking to get help in English, Please visit - Stack Overflow in English If you’re Looking to get help in English, Please Edit and Translate your Question.

  • 2

    Don’t forget to [Dit] the title.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.