I was not able to make ‘uuid’ work in my _id, so I changed it to objectId and got:
[Error: The following changes cannot be made in additive-only schema mode:
Property ‘Produit._id’ has been changed from ‘uuid’ to ‘object id’. If your app is running in development mode, you can delete the realm and restart the app to update your schema.]
I tried the troubleshooting, I tried
const realm = useRealm();
realm.write(() => {
// Delete all objects from the realm.
realm.deleteAll();
});
I went as far as;
const app = new Realm.App({ id: '<app id here>' });
const realm = await Realm.open({ schema: [Produit]});
Realm.App.Sync.initiateClientReset(app, realm.path);
realm.write(() => {
realm.deleteAll();
});
const syncConfigWithClientResetFallback = {
flexible: true,
clientReset: {
mode: 'recoverOrDiscardUnsyncedChanges', // or "recoverUnsyncedChanges"
// can also include `onBefore` and `onAfter` callbacks
onFallback: (_session, path) => {
try {
const didUserConfirmReset = showUserAConfirmationDialog();
if (didUserConfirmReset) {
// Close and delete old realm from device
realm.close();
Realm.deleteFile(path);
// Perform client reset
Realm.App.Sync.initiateClientReset(app, path);
}
} catch (err) {
}
},
},
};
export default function App() {
return (
<AppProvider id={'application-pam2-ceyvopp'}>
<UserProvider fallback={LogIn}>
<RealmProvider
schema={[Produit]}
sync={syncConfigWithClientResetFallback/*{
flexible: true,
initialSubscriptions: {
update(subs, realm) {
subs.add(realm.objects(Produit));
},
},
}*/}>
<Create/>
</RealmProvider>
</UserProvider>
</AppProvider>
)
}```
after that it just starts saying; [Error: Exception in HostFunction: Compiling JS failed: 26:21:';' expected Buffer size 8428 starts with: 5f5f642866756e6374696f6e2028676c]
and refuses to load. I am at my wit's end.
Alternatively, if any of you know how to make uuid work, I'd welcome that too, because that page is useless. https://www.npmjs.com/package/react-native-get-random-values
Thank you in advance!