In order for React Native developers to use the MongoDB watch method, they are required to perform the following setup to their project:
// Install the following dependencies
npm install react-native-polyfill-globals text-encoding;
// Add the following lines to index.js
import { polyfill as polyfillReadableStream } from "react-native-polyfill-globals/src/readable-stream";
polyfillReadableStream();
import { polyfill as polyfillEncoding } from "react-native-polyfill-globals/src/encoding";
polyfillEncoding();
import { polyfill as polyfillFetch } from "react-native-polyfill-globals/src/fetch";
polyfillFetch();
Solution
Add react-native-polyfill-globals and text-encoding as optional dependencies to Realm.
Throw a warning when they are not present when trying to use the mongodb watch method.
Give instructions on how to setup.
Make the setup as easy as:
import "realm/polyfills/react-native/watch";
Alternatives
Just document this better and have the developer do the heavy lifting.
Problem
In order for React Native developers to use the MongoDB
watch
method, they are required to perform the following setup to their project:Solution
Add
react-native-polyfill-globals
andtext-encoding
as optional dependencies to Realm. Throw a warning when they are not present when trying to use the mongodbwatch
method. Give instructions on how to setup. Make the setup as easy as:Alternatives
Just document this better and have the developer do the heavy lifting.
How important is this improvement for you?
Would be a major improvement
Feature would mainly be used with
Atlas App Services: Auth or Functions etc