galleryApi
dev2 siliconpin 2024-08-13 11:45:49 +00:00
parent 0381f74f06
commit 554b4e8946
1 changed files with 19 additions and 6 deletions

View File

@ -14,14 +14,27 @@ async function main() {
const collection = database.collection('gameData'); // Replace with your collection name
// Find a single document
const user = await collection.findOne({ userId: 'dsfdfgffgfgeg' });
// const user = await collection.findOne({ userId: 'dsfdfgffgfgeg' });
const { userId, gameName, gameID } = req.body;
const gameData = await collection.findOne({
userId: userId,
gameName: gameName,
gameID: gameID
});
if (gameData) {
res.json({gameData});
} else {
res.status(404).json({ message: 'Game data not found' });
}
// Output the result
if (user) {
console.log('User found:', user);
} else {
console.log('No user found with the username "john_doe"');
}
// if (user) {
// console.log('User found:', user);
// } else {
// console.log('No user found with the username "john_doe"');
// }
} catch (error) {
console.error('Error connecting to MongoDB or performing query:', error);
} finally {