Spaces:
Paused
Paused
Download dbSecondary.js from veltrixcode/GCX: direct link, hf CLI and curl.
- Browser
- Download file 468 Bytes
-
https://huggingface.co/spaces/veltrixcode/GCX/resolve/main/dbSecondary.js
- Command line
-
hf download hf://spaces/veltrixcode/GCX/dbSecondary.js
-
curl -L -o dbSecondary.js https://huggingface.co/spaces/veltrixcode/GCX/resolve/main/dbSecondary.js
468 Bytes
| const { MongoClient } = require('mongodb'); | |
| const uri = 'mongodb+srv://veltrix620:NSwuYBmjWz0vfgFw@cluster0.m5j5psk.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0'; | |
| let client; | |
| let db; | |
| async function getSecondaryDb() { | |
| if (db) return db; | |
| client = new MongoClient(uri, { useNewUrlParser: true, useUnifiedTopology: true }); | |
| await client.connect(); | |
| db = client.db(); // Uses the default database | |
| return db; | |
| } | |
| module.exports = { getSecondaryDb }; |