1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 13:14:06 +01:00
server/src/test/mongo_test.ts

21 lines
531 B
TypeScript
Raw Normal View History

2021-01-30 19:58:15 +01:00
import mongoose from "mongoose";
2021-02-02 00:51:00 +01:00
import { Long } from "mongodb";
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();