Read data from mongodb via GraphQL

Hello, 


Can you please advise how I can display the events stored in my mongo db via graphql? I've managed to find the way to add the events, but I can't quite figure out how I can read them and display in the calendar?


Thank you in advance!

Maria


3 Replies

IR Indumathi Ravichandran Syncfusion Team May 16, 2022 02:30 PM UTC

Hi Maria,


Currently, we are validating your requirement of “Read data from mongodb vis GraphQL in the Flutter calendar”. We will validate and update you the further details on or before May 18, 2022. We appreciate your patience until then.


Regards,

Indumathi R



MD Maria Donosova May 16, 2022 04:37 PM UTC

Thank you, this is what I've tried to do (using graphql_flutter packager), however it looks like flutter can't cast query into list.


List appointments = Query(
      options: QueryOptions(document: gql(_getEvents)),
      builder: (result, {fetchMore, refetch}) {
        if (result.isLoading) {
          return const CircularProgressIndicator();
        } else {
          result.data!["events"];
        }
        throw const Text('Something happened');
      }) as List;
  return _DataSource(appointments);
}


IR Indumathi Ravichandran Syncfusion Team May 17, 2022 02:03 PM UTC

Hi Maria,


The result data contains the response in map or list format. If possible, can you please refer the following KB for converting the response into datasource. Please find the KB documentation from the following link.


KB link:

https://www.syncfusion.com/kb/12067/how-to-work-with-the-firebase-database-and-the-flutter-calendar-for-appointments


Also please find the KB documentation for adding the custom appointment.


KB link:

https://www.syncfusion.com/kb/11529/how-to-add-a-custom-appointments-or-objects-in-the-flutter-calendar


Please find the UG documentation for adding the custom appointment in the Flutter Calendar and getting the business object  data.


UG links:

https://help.syncfusion.com/flutter/calendar/appointments#calendar-data-source-and-mapping

https://help.syncfusion.com/flutter/calendar/appointments#creating-business-objects

https://help.syncfusion.com/flutter/calendar/appointments#get-the-business-object-data

We hope that this helps you. Please let us know if you need further assistance.


Regards,

Indumathi R


Loader.
Up arrow icon