-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
How frequently does the bug occur?
Always
Description
Hi, I am using realm on react native
The issue is that when I tried to query collections that I do not insert on app (users for example) the app does not sync the data for that collection and I cant query that.
Why isn't it syncing all collections that is declared on de realm context config ?
Real examples:
// Collection that has some inserts on app: //
type GenerateProps = {
title: string;
banner?: string;
text: string;
structs: string[];
sticked?: boolean;
urgent?: boolean;
};
export class News extends Realm.Object<News> {
_id!: Realm.BSON.UUID;
title!: string;
banner!: string;
text!: string;
createdAt!: Date;
structs!: string[];
deleted!: boolean;
static generate(
{ title, banner, text, createdBy, structs, sticked, urgent, }: GenerateProps) {
return
;
}
static schema: ObjectSchema = {
name: "News",
properties: { _id: "objectId", title: "string", banner: "string?", text: "string", createdAt: "date", structs: { type: "list", objectType: "objectId", }, sticked: { type: "bool", default: false, indexed: true, }, urgent: { type: "bool", default: false, indexed: true, }, deleted: { type: "bool", default: false, indexed: true, }, },
primaryKey: "_id",
};
}
// Collection that has not any insert on app: //
export class Users extends Realm.Object<Users> {
_id!: Realm.BSON.UUID;
name!: string;
document!: string;
register!: string;
"__v": number;
createdAt!: Date;
email!: string;
fcmToken?: string;
updatedAt?: Date;
static schema: ObjectSchema = {
name: "Users",
properties: { _id: "objectId", name: "string", document: "string", register: "string", __v: "int", createdAt: "date", email: "string", fcmToken: "string?", updatedAt: "date", },
primaryKey: "_id",
};
}
// realm context config: //
const realmAccessBehavior: Realm.OpenRealmBehaviorConfiguration = {
type: Realm.OpenRealmBehaviorType.OpenImmediately,
};
export const syncConfig: any = {
flexible: true,
newRealmFileBehavior: realmAccessBehavior,
existingRealmFileBehavior: realmAccessBehavior,
};
export const
{ RealmProvider, useRealm, useQuery, useObject } =
createRealmContext(
);
// realm sync useEffect: //
useEffect(() => {
realm.subscriptions.update((mutableSubs, realm) => {
const news = realm.objects("News");
const users = realm.objects("Users");
mutableSubs.add(news, { name: "news" }); mutableSubs.add(users, { name: "users" }); });
}, [realm]);
Not including the appProvider and etc.. because I think it is standart.
Using Anonymous session on attlas
News Collection is working as normal but users has never synced any data from atlas
Is there any missing config ?
Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
No response
Version
@realm/react: 0.6.2 realm: 12.5.0
What services are you using?
Atlas Device Sync
Are you using encryption?
No
Platform OS and version(s)
React Native 0.72.6, expo
Build environment
Which debugger for React Native: ..
Cocoapods version
No response