Hi there!
I’m using Realm sync to build an iOS app.
I have a collection named Students:
{
"title": "Students",
"bsonType": "object",
"required": [
"_id",
"_parentId"
],
"properties": {
"_id": {
"bsonType": "objectId"
},
"_parentId": {
"bsonType": "string"
},
"lastName": {
"bsonType": "string"
}
}
where _parentId
is the partition value I use to access some objects of the collection, like this:
self.realm = try! Realm(configuration: realmApp.currentUser!.configuration(partitionValue: "myPartitionValue"))
// Access all students in the collection matching the partition value
self.students = self.realm?.objects(Students.self).sorted(byKeyPath: "lastName")
I would like to access all the students in the collection, regardless of their _parentId
(partition value). I tried to do the followings but I got nothing:
- First try:
Realm.asyncOpen() { (response) in
let students = try! response.get().objects(Students. self )
}
- Second try:
let realm = try! Realm() let students = realm.objects(Students.self)
Do you know how can I get all the Students without iterating on all the different partition value (i.e _parentId
)?
Thanks for your help!