-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collection.watch() error Aborted on React Native SDK #6174
Comments
Hi @BondPiyapan, are you seeing this on both iOS and Android? For Android, the community fetch polyfill that enables text streaming is not working (see their issue here). Can you also verify if you're still experiencing the issue in release mode? ( |
I am using |
You can always use Device Sync and add listeners to react to changes. Can I ask what the reason is for not using Device Sync for your use case? |
Good point. I am not sure why I have not tried that feature yet. I will give it a try. |
After some review and thinking. I think there might be some difficulty for me to use Device Sync. I have a database that many collection and I only want to monitor the notification collection. As what I understand at the moment, Device Sync does not allow sync a single collection. Which means, all other data on the database will also be sync to the device which I don't want and need. |
Device Sync is very flexible with what should be synced to the device. In your case, to sync only a specific collection, you would only subscribe to that collection. Take e.g. the following example from the docs where only objects of the import React from 'react';
import {AppProvider, UserProvider, RealmProvider} from '@realm/react';
function AppWrapperSync() {
return (
<AppProvider id={APP_ID}>
<UserProvider fallback={LogIn}>
<RealmProvider
schema={[YourObjectModel]}
sync={{
flexible: true,
initialSubscriptions: {
update(subs, realm) {
subs.add(realm.objects(YourObjectModel));
},
},
}}>
<RestOfApp />
</RealmProvider>
</UserProvider>
</AppProvider>
);
} Since you only have a subscription to If it would help, you can also have a look at one of our example apps and the provided README. If you encounter what you think is a bug, feel free to open a new issue specifically for that. |
How frequently does the bug occur?
Always
Description
I’m need get data change realtime
use collection.watch() return error [AbortError: Aborted]
use by Realm react-native
this code
const user = useUser()
useEffect(() => {
const setupChangeStream = async () => {
try {
const collection = user!
.mongoClient('mongodb-atlas')
.db('dev')
.collection('Job')
}, [user])
I have set accordingly Examples of every step finished.
https://www.mongodb.com/docs/realm/sdk/react-native/app-services/query-mongodb/#real-time-change-notifications
Thank you.
Stacktrace & log output
Can you reproduce the bug?
Always
Reproduction Steps
No response
Version
12.1.0
What services are you using?
Atlas Device Sync
Are you using encryption?
Yes
Platform OS and version(s)
All platform
Build environment
Which debugger for React Native: ..
Cocoapods version
No response
The text was updated successfully, but these errors were encountered: