galleryApi
parent
554b4e8946
commit
879a792907
|
@ -2,15 +2,16 @@ const getGameScore = (req, res) => {
|
||||||
const { MongoClient } = require('mongodb');
|
const { MongoClient } = require('mongodb');
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const uri = 'mongodb://mongoadmin:Bijaynagardwd@10.0.0.90:27017'; // Replace with your MongoDB connection string
|
const url = process.env.MONGODB_URL;
|
||||||
const client = new MongoClient(uri, { useNewUrlParser: true, useUnifiedTopology: true });
|
const dbName = process.env.MONGO_DB_NAME;
|
||||||
|
const client = new MongoClient(url, { useNewUrlParser: true, useUnifiedTopology: true });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Connect to the MongoDB client
|
// Connect to the MongoDB client
|
||||||
await client.connect();
|
await client.connect();
|
||||||
|
|
||||||
// Select the database and collection
|
// Select the database and collection
|
||||||
const database = client.db('iimttnewdb'); // Replace with your database name
|
const database = client.db(dbName); // Replace with your database name
|
||||||
const collection = database.collection('gameData'); // Replace with your collection name
|
const collection = database.collection('gameData'); // Replace with your collection name
|
||||||
|
|
||||||
// Find a single document
|
// Find a single document
|
||||||
|
|
Loading…
Reference in New Issue