summary refs log tree commit diff
path: root/src/test/mongo_test.ts
blob: b3fadf5a80e7fedd6c37ffbff891287386aa413d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import mongoose from "mongoose";
import { Long } from "mongodb";
import { Snowflake } from "discord-server-util";

async function main() {
	const conn = await mongoose.createConnection(
		"mongodb://localhost:27017/lambert?readPreference=secondaryPreferred",
		{
			useNewUrlParser: true,
			useUnifiedTopology: false,
		}
	);
	console.log("connected");
	const result = await conn.collection("users").insertOne({ test: Long.fromString(Snowflake.generate().toString()) });
	// .project(undefined)

	console.log(result);
}

main();