{"id":18523602,"url":"https://github.com/mongoosejs/mongoose-number","last_synced_at":"2025-04-09T11:31:42.542Z","repository":{"id":4163188,"uuid":"5278136","full_name":"mongoosejs/mongoose-number","owner":"mongoosejs","description":"Provides Mongoose v2 sub-classed Number with atomic increment/decrement support","archived":false,"fork":false,"pushed_at":"2015-07-13T13:57:59.000Z","size":203,"stargazers_count":13,"open_issues_count":2,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-19T18:41:13.045Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://aheckmann.github.com/mongoose-number","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mongoosejs.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-02T21:29:35.000Z","updated_at":"2017-03-20T15:06:06.000Z","dependencies_parsed_at":"2022-09-20T13:34:21.124Z","dependency_job_id":null,"html_url":"https://github.com/mongoosejs/mongoose-number","commit_stats":null,"previous_names":["aheckmann/mongoose-number"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoosejs%2Fmongoose-number","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoosejs%2Fmongoose-number/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoosejs%2Fmongoose-number/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoosejs%2Fmongoose-number/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mongoosejs","download_url":"https://codeload.github.com/mongoosejs/mongoose-number/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248031508,"owners_count":21036418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T17:36:28.133Z","updated_at":"2025-04-09T11:31:39.942Z","avatar_url":"https://github.com/mongoosejs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#mongoose-number\n===============\n\nProvides Mongoose v2 Number support for [Mongoose](http://mongoosejs.com) v3.\n\n[![Build Status](https://secure.travis-ci.org/aheckmann/mongoose-number.png)](http://travis-ci.org/aheckmann/mongoose-number)\n\nExample:\n\n```js\nvar mongoose = require('mongoose')\nrequire('mongoose-number')(mongoose);\n\nvar partSchema = new Schema({ num: 'MongooseNumber' });\nvar Part = db.model('Part', partSchema);\n\nvar part = new Part({ num: 47 });\npart.save(function (err) {\n  Part.findById(part, function (err, part) {\n    part.num.increment(); // uses atomic $inc\n    part.save(function (err) {\n      Part.findById(part, function (err, part) {\n        console.log(part.num) // 48\n      })\n    })\n  })\n})\n```\n\nIn Mongoose v2 every number was cast to this custom type. This type was removed due to the following caveats:\n\n  [run this gist](https://gist.github.com/3239372)\n\nObserve the result of `typeof a.n1`. Its \"object\" not \"number\"! Next observe the direct comparison of two mongoose numbers, `a.n1 == a.n2` is false. This makes javascript programs very sad.\n\nSo the benefits of handy helper methods that are rarely used (though convenient) did not outweigh the broken behavior they exhibit, hence their removal in v3.\n\nUse this module at your own risk, or better yet, not at all.\n\n## Provided number methods\n\n- number#increment\n- number#decrement\n- number#$inc\n- number#$dec\n\n## Compatibility\n\n- mongoose-number 0.0.2 is compatibile with `Mongoose \u003e= v3.0.0 \u003c v3.6.0`\n- mongoose-number 0.1.0 is compatibile with `\u003e= Mongoose v3.6.0`\n\n[LICENSE](https://github.com/aheckmann/mongoose-number/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongoosejs%2Fmongoose-number","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmongoosejs%2Fmongoose-number","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongoosejs%2Fmongoose-number/lists"}