Skip to content

Asteroid & Subscriptions #116

@aadamsx

Description

@aadamsx

Before switching to React or Vue, I'm trying out Blaze with Asteroid (since my existing code base is Blaze). Most all examples I see are Asteroid + React/Redux, where the contents of the Subscription are piped into the Redux store.

The only issue I see so far with Asteroid is, when using it with Blaze (as a test), I don't see a way to pipe in the subscription into mini-mongo.

For example, I inside the ddp.on('added' ...) I cannot do a People.findOne({userId: ID}), like I could with mini-mongo. So at least with Blaze, there seems to be no way to get the data out from the subscription...

// asteroid.js
asteriod.subscrib('People');

asteroid.ddp.on('added', (doc) => {
  if (doc.collection === 'People') {
    // I see the data
    // wish I could query like let ppl = People.findOne({userId: ID});
  }
}); 

// names.js
Template.namesOverview.onCreated(function() {
   // let ppl = People.find({}); // doesn't work!
});

I get an Object inside 'added' like so:

collection: "People"
fields: Object
  createdAt: Object
  firstName: 'Test'
  lastName: 'Test'
id: "asdfWkfasedf"
msg: "added"

My question, is there a way to query the subscription like I do in mini-mongo?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions