galleryApi
parent
0381f74f06
commit
554b4e8946
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue