Multiple collections are not getting updated.
shashankgupta3766 opened this issue · 3 comments
There are few subscription in which we want to update multiple collections, but it's not working as expected.
Can you provide some examples or provide some gist to understand what you are trying to achieve?
Hi Engr,
There is requirement in which I am updating multiple collections with one subscription. We're not getting data in that those cases.
For example:
meteorSwift.subscribe(“subscription name”, params: arrParam, collectionName: nil, callback: { (event, doc) in
switch event {
case .dataAdded:
print(doc.fields ?? "")
break
case .dataChange:
print(doc.fields ?? "")
if doc.fields != nil {
}
break
case .dataRemove:
break
}
}) {
print("recipe.mealPlanWeek: Subscription Done")
}
This is working fine with the Objective C SDK. https://github.com/martijnwalraven/meteor-ios
This callback is designed for only getting specified collection records in its scope. If you wish to listen to other collections too, you can add observers to their collectionNames. Since Meteor works directly with listening to the collection records, it's recommended to observe each collection separately and not to associate that collection with the subscription(publish-subscribe).
You can listen to any collection with its name by just adding the observer like below.
self.meteor.addEventObserver(collectionName, event: .dataAdded) {
let value = $0 as! MeteorDocument
}