I have successfully connected using Realm with flexible sync. In the provider I attempt to retrieve a list of projects using
realm.objects("Project");
And I get an empty array though the Atlas database contains data.
When I attempt to use useQuery(Project), I get the following error:
Error: Expected an object schema name, object instance or class
This is my schema:
// import Realm from "realm";
import Realm from "realm";
export class Project extends Realm.Object {
static schema = {
name: "Project",
primaryKey: "_id",
properties: {
_id: "uuid",
area: "string",
customer: "string",
customercontact: "string",
rigcompany: "string",
projectname: "string",
description: "string",
projectedstartdate: "date",
actualstartdate: "date",
expectedduration: "int",
actualduration: "int",
status: "string",
statusdate: "date",
comment: "string",
latdec: "double",
longdec: "double",
},
};
}
My relevant App.js code:
export default AppWrapper = () => {
return (
<AppProvider id={"devicesync - xxxxx"}>
<RealmProvider schema={Project}>
<ContextProvider>
<App />
</ContextProvider>
</RealmProvider>
</AppProvider>
);
};