Hi everyone we are working on app in which about 60% is non-reactive so we are doing in this way:-
create meteor methods in server side and call it from client Meteor.methods({ fetchData:(limit){ return db.someData.find({},{limit:limit}.fetch() } });
Try this package https://atmospherejs.com/ouk/static-subs
Your workflow is same as writing publications and subscribing to them.
Only difference is that you register publication with StaticSubs.publish and subscribe with StaticSubs.subscribe
Signature of these functions are matching thous on Meteor
With this package you don’t need to register a method and when calling it on client think where to put received data.
With this package you publish data same as you write Meteot.publish.
This is how you retrieve reactive data
Meteor.publish('stores', function() {
return [
Stores.find(),
StoredLocations.find()
]
})
Meteor.subscribe('stores')
// then somewhere
let location = StoreLocations.findOne({ ... })
let stores = Stores.find({ locationId: location._id }).map( ... )
Using ouk:static-subs package you instead write:
StaticSubs.publish('stores', function() {
return [
Stores.find(),
StoredLocations.find()
]
})
StaticSubs.subscribe('stores')
// then somewhere
let location = StoreLocations.findOne({ ... })
let stores = Stores.find({ locationId: location._id }).map( ... )
Under the hood the package use method call and inject received data into appropriate minimongo collections. You don’t need to use any other persistence on client.