Comments (5)
collection.js
Posts = new Mongo.Collection('posts')
Meteor.isServer && Meteor.publish('posts', function() {
// ReactiveAggregate(this, Posts, [{
// $lookup: {
// from: 'users',
// localField: 'userId',
// foreignField: '_id',
// as: 'user'
// }
// }])
return [Posts.find(), Users.find()]
})
client.js
Template.registerHelper('posts', function () {
return Posts.find().map(post => {
return _.extend(post, {
user: Users.find(post.userId)
})
})
})
from meteor-reactive-aggregate.
Thanks for your reply.
Could example?
from meteor-reactive-aggregate.
@JcBernack - Is there any way to get reactivity of collection used by $lookup? I'm in a situation that I cannot use your above proposed solution that "publish other collections and join them on client side". Because of the huge amount of data in the other collection I cannot publish them. At the same time I need to aggregate with that collection data. Your suggestions would be very much appreciated
from meteor-reactive-aggregate.
This package observes changes in the given collection (Disbursement
) and updates the aggregation. Changes to the collection used by $lookup
will go unnoticed. Maybe you should push the other collections via separate publications and "join" on the client side.
from meteor-reactive-aggregate.
Thanks for posting this example. The reduction and flexibility of my code changes in relation to publications (publish composite, reactive join aggregations), coupled using react-komposer, simply exquisite. Fair amount of unbounded arrays requiring aggregations, so denormalizing was not a very good option (or really much of an option at all). This solved a ton of problems and helped me think of a couple of new ways to do things. Thanks again!
from meteor-reactive-aggregate.
Related Issues (20)
- Is the any chance that the package does not work in test mode ? HOT 2
- Single document published HOT 2
- Cannot set property '_ids' of undefined HOT 4
- Does this method works reactively on server? HOT 2
- $lookup returning empty array HOT 2
- Problem with Methods deletetion HOT 15
- Publish latest version to atmoshphere HOT 1
- Add the ability to stop and restart aggregation HOT 2
- returned with empty HOT 1
- Can't combine reactive publish with plain cursor HOT 5
- Reactive aggregate is not defined HOT 4
- Add one example howto import the ReactiveAggregate module
- Delay between subscription.ready() and data availability HOT 2
- ReactiveAggregate returns Mongo types instead of Meteor
- observeOptions does nothing / can't use limit and skip HOT 2
- ReactiveAggregate not working with $lookup HOT 1
- ReactiveAggregate() + collection.update() -> Error: Expected to find a document to change HOT 1
- Aggregate and filter with full text indexes HOT 1
- Aggregation takes time with large collections HOT 1
- Need for a new version number ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-reactive-aggregate.