Added lanes (first try)
This commit is contained in:
@@ -1,17 +1,5 @@
|
||||
import { MongoClient } from 'mongodb'
|
||||
import {connectToDatabase, fetchLatestPatch} from '../../utils/mongo'
|
||||
|
||||
async function connectToDatabase() {
|
||||
// Create a MongoClient with a MongoClientOptions object to set the Stable API version
|
||||
const client = new MongoClient(`mongodb://${process.env.MONGO_USER}:${process.env.MONGO_PASS}@mongo:27017`)
|
||||
await client.connect()
|
||||
return client
|
||||
}
|
||||
async function fetchLatestPatch(client) {
|
||||
const database = client.db("patches");
|
||||
const patches = database.collection("patches");
|
||||
const latestPatch = await patches.find().limit(1).sort({date:-1}).next()
|
||||
return latestPatch.patch
|
||||
}
|
||||
async function championInfos(client, patch, championAlias) {
|
||||
const database = client.db("champions");
|
||||
const collection = database.collection(patch);
|
||||
|
||||
Reference in New Issue
Block a user