Package Exports
- mongoose-long
- mongoose-long/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mongoose-long) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
#mongoose-long
Provides Number Long support for Mongoose.
Example:
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-longSee node-mongodb-native docs on all the Long methods available.
TypeScript Usage
Make sure you enable both compilerOptions.allowSyntheticDefaultImports and compilerOptions.esModuleInterop in your tsconfig.json.
import mongoose from 'mongoose';
import mongooseLong from 'mongoose-long';
mongooseLong(mongoose);
const Long = mongoose.Schema.Types.Long;