Mongo.Cursor ngFor


I’m very new to Meteor, and i’m trying to do a simple test with Mongo (similar to the tutorial) as follows:

(part of my Angular 2 Component)

export class JobsComponent {
  jobs: Mongo.Cursor<Object>;

  constructor() { = Jobs.find();

Then i’m trying to iterate over ‘jobs’ using:
*ngFor="let job of jobs"

But I get an error saying:

Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.

How do I convert the Mongo.Cursor object into an iterable array?



Sorry I managed to get it working with pub/sub method explained here:

(I don’t know how to remove this topic…)


Don’t worry about removing it - leaving questions like this here, with a solution, will more than likely help someone else down the road.


But the question remains. I have same issue, when I do exactly like in tutorial it works, in my case it’s not. I have checked in both cases it receives a Cursor.
I dig further, but maybe there is a quick answer from guru?:slight_smile:


Ok, I found the problem. RTFM!)

import {bootstrap} from ‘angular2-meteor-auto-bootstrap’;
And now you can iterate Mongo.Cursor objects with Angular 2.0 ngFor!


angular2-meteor is a fast moving target. A lot has been done to make it as simple to use as blaze was. I think recently @Urigo added component MeteorReactive and some service providers METEOR_PROVIDERS that helps make ngFor work smoothly with Mongo Cursors.

Check the below links to know more:

Also check this example repo to know, how METEOR_PROVIDERS are injected into app module and how MeteorReactive to extend to define components with reactive attributes. Both of these do the magic of making ngFor work with Mongo Cursors.


thanks @gauravdhiman

Yes it was a fast moving target, but not anymore.
The API is solid and everyone can start using it