realm-js icon indicating copy to clipboard operation
realm-js copied to clipboard

Upgrade to BSON v5

Open takameyer opened this issue 2 years ago • 2 comments

Currently, upgrading bson to v5 causes the integration tests to fail in react-native. It's probably due to some polyfills needing to be implemented. We should investigate what is needed to be done here in order to stay up to date with the current updates to the bson package.

takameyer avatar Jul 31 '23 09:07 takameyer

Sorry if I do not open a new issue, but mine is a little bit related.

I have a RN project where I had an issue with the realm / BSON import statements (like this one import { UUID } from 'bson';).

Since I am using BSON only for UUID, can I use any other library to define the UUID fields in my schema as I read on BSON's Jira that RN is not clearly supported ?

Because right now, I had to downgrade to v4.x and then also downgrade Realm to v10.x.

LiohAu avatar Aug 03 '23 14:08 LiohAu

@LiohAu You can import BSON directly out of realm, as we re-export it.

import { BSON } from 'realm';

const id = new BSON.UUID();

Currently you we only store BSON types, but you can use another library and transform it to a string, if that's desired. You shouldn't have to downgrade Realm in order to use v4.x.

takameyer avatar Aug 04 '23 08:08 takameyer

Closing this issue in favour of https://github.com/realm/realm-js/issues/6561

kraenhansen avatar Mar 18 '24 21:03 kraenhansen