Skip to content
This repository has been archived by the owner on Mar 2, 2022. It is now read-only.

Format code with standardjs and prettier #29

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions mongo-setup.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
require("dotenv").config();
const { MongoClient } = require('mongodb');
const { MongoClient } = require("mongodb");
const { exit } = require("process");
const mongouri = process.env.DB_URI || "mongodb://localhost"; //mongo connection string
const mongouri = process.env.DB_URI || "mongodb://localhost"; // mongo connection string
async function setup() {
const client = new MongoClient(mongouri);
await client.connect();
const metahkgthreads = client.db("metahkgthreads");
const metahkgusers = client.db("metahkgusers");
await metahkgthreads.collection("hottest").createIndex({ "createdAt": 1 }, { expireAfterSeconds: 172800 });
await metahkgthreads.collection("summary").createIndex({ "op": "text", "title": "text" }); //text search
await metahkgusers.collection("limit").createIndex({ "createdAt": 1 }, { expireAfterSeconds: 86400 });
await metahkgusers.collection("verification").createIndex({ "createdAt": 1 }, { expireAfterSeconds: 300 });
exit(0);
const client = new MongoClient(mongouri);
await client.connect();
const metahkgthreads = client.db("metahkgthreads");
const metahkgusers = client.db("metahkgusers");
await metahkgthreads
.collection("hottest")
.createIndex({ createdAt: 1 }, { expireAfterSeconds: 172800 });
await metahkgthreads
.collection("summary")
.createIndex({ op: "text", title: "text" }); // text search
await metahkgusers
.collection("limit")
.createIndex({ createdAt: 1 }, { expireAfterSeconds: 86400 });
await metahkgusers
.collection("verification")
.createIndex({ createdAt: 1 }, { expireAfterSeconds: 300 });
exit(0);
}
setup();
setup();