degee147
degee147

Reputation: 255

Error: Object type 'Task' not found in schema

I recently cloned the Realm React Native Tutorial app from https://github.com/mongodb-university/realm-tutorial-react-native and using the sync guide at https://www.youtube.com/watch?v=sDHNyDQOQvA, I configured my appId in getRealmApp.js, that's basically what I've done, nothing custom, at least not yet :)

However, running the app on the emulator, registration works fine, but upon adding a new task, I get the error:

Error: Object type 'Task' not found in schema.

Assistance here would be greatly appreciated

Upvotes: 1

Views: 1023

Answers (1)

degee147
degee147

Reputation: 255

Well, after some thorough checking of the docs, I had to add the schema to Realm.open(config)

  const config = {
      schema: [Task.schema], //this line wasn't there
      sync: {
        user: user,
        partitionValue: projectPartition,
        newRealmFileBehavior: OpenRealmBehaviorConfiguration,
        existingRealmFileBehavior: OpenRealmBehaviorConfiguration,
      },
  };

Upvotes: 1

Related Questions