-
I have like this “GameSession” data
-
here “gameCatalogueId” contain data of “GameCatalogue” table data
-
“gameCatalogueId” have one “GameCatalogue” table data
-
this data seen in parse dashbord but when i want get those data using API its not provide all data
const fetchData = async () => {
// Create a new Parse Query
const GameSession = Parse.Object.extend('GameSession');
const query = new Parse.Query(GameSession);
try {
// Execute the query to retrieve all records
const results = await query.find();
// console.log("===", results);
// Loop through each GameSession to get related GameCatalogue data
for (const session of results) {
const relation = session.relation('GAMECATALOGUE'); // Get the relation
const gameCatalogueQuery = relation.query(); // Create query for the relation
const gameCatalogues = await gameCatalogueQuery.find(); // Fetch related GameCatalogue
console.log("===", gameCatalogues);
// Map and log session and game catalogue details
const sessionData = gameCatalogues.map((game) => ({
sessionId: session.id,
gameCatalogueId: game.id,
gameName: game.get('name'),
}));
console.log(sessionData);
}
} catch (error) {
console.error('Error while fetching data:', error);
}
};
- Need data of most played games