realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.6k stars 558 forks source link

RJS-2765: Upgrade BSON #6593

Open elle-j opened 3 weeks ago

elle-j commented 3 weeks ago

What, How & Why?

Upgrading packages to use BSON v6. There are several breaking changes (v5, v6) in the BSON package, some of which affect us.

Notes on breaking changes:

Blocking:

This closes #6561

☑️ ToDos

kraenhansen commented 1 week ago

I've rebased on latest main to get b88a065cbd50cf1b84f381d1ab1a781d72bd4f2e and force-pushed to your branch 🤞

kraenhansen commented 1 week ago

Latest React Native specific failure:

ReferenceError: Property 'btoa' doesn't exist
      at webByteUtils.toBase64 (/Users/runner/work/realm-js/realm-js/node_modules/bson/lib/bson.cjs:387:15)
      at Binary#toExtendedJSON (/Users/runner/work/realm-js/realm-js/node_modules/bson/lib/bson.cjs:549:47)
      at serializeDocument (/Users/runner/work/realm-js/realm-js/node_modules/bson/lib/bson.cjs:4088:36)
      at serializeValue (/Users/runner/work/realm-js/realm-js/node_modules/bson/lib/bson.cjs:4021:32)
      at stringify (/Users/runner/work/realm-js/realm-js/node_modules/bson/lib/bson.cjs:4120:30)

Metro seems to pick up "bson/lib/bson.cjs" instead of the RN specific bundle that is included in bson 🤔