2021-02-14 19:01:41 +01:00
|
|
|
import mongoose, { Schema, Types } from "mongoose";
|
|
|
|
import { Long as MongoTypeLong } from "mongodb";
|
|
|
|
require("mongoose-long")(mongoose);
|
|
|
|
|
|
|
|
const partSchema = new Schema({
|
|
|
|
long: {
|
|
|
|
type: mongoose.Types.Long,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const Part = mongoose.model("Part", partSchema, "test");
|
2021-01-30 19:58:15 +01:00
|
|
|
|
|
|
|
async function main() {
|
2021-02-14 19:01:41 +01:00
|
|
|
const conn = await mongoose.connect("mongodb://localhost:27017/lambert?readPreference=secondaryPreferred", {
|
|
|
|
useNewUrlParser: true,
|
|
|
|
useUnifiedTopology: false,
|
|
|
|
});
|
2021-01-30 19:58:15 +01:00
|
|
|
console.log("connected");
|
2021-02-01 21:49:01 +01:00
|
|
|
|
2021-02-14 19:01:41 +01:00
|
|
|
const part = new Part({ long: 390810485244821505n });
|
|
|
|
|
|
|
|
// await part.save();
|
|
|
|
console.log("saved");
|
|
|
|
const test = await Part.find({});
|
|
|
|
console.log(test);
|
2021-01-30 19:58:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
main();
|