2021-01-30 19:58:15 +01:00
|
|
|
import mongoose from "mongoose";
|
2021-02-02 00:51:00 +01:00
|
|
|
import { Long } from "mongodb";
|
2021-02-10 14:16:30 +01:00
|
|
|
import { Snowflake } from "fosscord-server-util";
|
2021-01-30 19:58:15 +01:00
|
|
|
|
|
|
|
async function main() {
|
2021-02-01 21:49:01 +01:00
|
|
|
const conn = await mongoose.createConnection(
|
2021-01-30 19:58:15 +01:00
|
|
|
"mongodb://localhost:27017/lambert?readPreference=secondaryPreferred",
|
|
|
|
{
|
|
|
|
useNewUrlParser: true,
|
|
|
|
useUnifiedTopology: false,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
console.log("connected");
|
2021-02-02 00:51:00 +01:00
|
|
|
const result = await conn.collection("users").insertOne({ test: Long.fromString(Snowflake.generate().toString()) });
|
2021-02-01 21:49:01 +01:00
|
|
|
// .project(undefined)
|
|
|
|
|
|
|
|
console.log(result);
|
2021-01-30 19:58:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
main();
|