Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8181767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:38:11+00:00 2026-06-07T00:38:11+00:00

When using this user.meta.logins.$inc(); I get this error in the console: Mongoose MongooseNumber#$inc /

  • 0

When using this user.meta.logins.$inc(); I get this error in the console:

Mongoose MongooseNumber#$inc / MongooseNumber#increment is deprecated.
Use Model.update() to get incrementation in v3 instead.

What I have beed doing is this (code is stripped down to the basic usage):

userSchema.methods = {
  userFind : function (user, pass, callback) {
    this.model('user').findOne({ 'username':user, 'password':pass }, callback); 
  }
}

var userModel = new model();
userModel.userFind(username, password, function(err, user) {
  user.meta.logins.$inc();
  user.meta.last_action = new Date();                   
  user.save();
});

This works just fine but since the deprecation is at hand, I want to use the proposed Model.update() method to update the user, however I can’t make it happen.

I have tried doing userModel.update() and user.update() but in both cases I get errors. Maybe my syntax is wrong for the update.

Any ideas would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:38:13+00:00Added an answer on June 7, 2026 at 12:38 am

    To use update for this:

    userModel.update(
      { 'username': user, 'password': pass },
      { $inc: { logins: 1 }, $set: { last_action: new Date() }},
      function(err, numAffected) {
        ...
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get the memberOf property for my user using this code: DirectorySearcher search =
Now i'm using this code: User has_one User_extra User => :username, :email, :crypted_password, :salt,
We alert user using this javascript, now i want to add this functionality to
I am using this for sending file to user header('Content-type: application/zip'); header('Content-Length: ' .
So I've been using this code to automatically serialize my User business object which
Hi I'm using this code below to let a user draw their signature on
I'm using Xcode 4.3 and I have followed this user's steps to create the
I'm using Linq-to-XML to do a simple is this user registered check (no security
Good day, i have a meta like this <meta name=viewport content=initial-scale=1.0, maximum-scale=1.0, user-scalabale=no, width=device-width,
I am working off this test page: http://www.comehike.com/test_fb_connect.php When the user logs in using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.