# mongoose-long

> Long number type for Mongoose

Latest version **0.8.0** (published 2023-11-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install mongoose-long
pnpm add mongoose-long
yarn add mongoose-long
bun add mongoose-long
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.0 |
| Published | 2023-11-01 |
| First published | 2012-08-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 80 |
| Author | Aaron Heckmann |
| Maintainers | aaron, vkarpov15 |
| Keywords | mongoose, long, number, type, schematype, schema |

## Links

- npm: https://www.npmjs.com/package/mongoose-long
- Repository: https://github.com/aheckmann/mongoose-long
- Homepage: https://github.com/aheckmann/mongoose-long#readme
- Issues: https://github.com/aheckmann/mongoose-long/issues
- npm.io page: https://npm.io/package/mongoose-long

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 0.8.0 (latest) — 2023-11-01
- 0.7.1 — 2023-08-22
- 0.7.0 — 2023-06-01
- 0.6.0 — 2022-10-25
- 0.5.1 — 2022-01-05
- 0.5.0 — 2021-10-21
- 0.4.1 — 2021-08-10
- 0.4.0 — 2021-05-21
- 0.3.2 — 2020-09-19
- 0.3.1 — 2020-07-18
- 0.3.0 — 2020-04-18
- 0.2.1 — 2018-05-17
- 0.2.0 — 2018-02-26
- 0.1.1 — 2016-10-17
- 0.1.0 — 2016-01-28
- … 2 more at https://npm.io/package/mongoose-long/versions

## README

#mongoose-long
===============

Provides Number Long support for [Mongoose](http://mongoosejs.com).

[![Build Status](https://secure.travis-ci.org/aheckmann/mongoose-long.png)](http://travis-ci.org/mongoosejs/mongoose-long)

Example:

```js
const mongoose = require('mongoose')
require('mongoose-long')(mongoose);
const {Types: {Long}} = mongoose;

const partSchema = new Schema({
  long: {
    type: Long,
  }
});

const Part = db.model('Part', partSchema);
const part = new Part({long: '9223372036854775806'});

part.long = part.long.divide(Long.fromString('2'));
part.save()
```

### install

```
npm install mongoose-long
```

See [node-mongodb-native](https://mongodb.github.io/node-mongodb-native/4.2/classes/Long.html) docs on all the `Long` methods available.

[LICENSE](https://github.com/aheckmann/mongoose-long/blob/master/LICENSE)

### TypeScript Usage

Make sure you enable both `compilerOptions.allowSyntheticDefaultImports` and `compilerOptions.esModuleInterop` in your `tsconfig.json`.

```typescript
import mongoose from 'mongoose';
import mongooseLong from 'mongoose-long';

mongooseLong(mongoose);

const Long = mongoose.Schema.Types.Long;
```

---
_Source: https://npm.io/package/mongoose-long · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
