I'm working through a meteor tutorial : https://www.meteor.com/tutorials/blaze/collections
I have a collection defined,
Tasks = new Mongo.Collection("tasks");
I've added two items to it, one directly from meteor mongo command line, and another one using:
Tasks.insert({ text: "Testing JS", createdAt: new Date() });
Here are the results from running db.tasks.find() on the backend:
{ "_id" : ObjectId("559e9569abbb64fe1d5fd89a"), "text" : "Hello world!", "createdAt" : ISODate("2015-07-09T15:38:17.742Z") }
{ "_id" : "obRN8Rcssa9yJqXzA", "text" : "Testing JS", "createdAt" : ISODate("2015-07-09T17:00:13.285Z") }
But when I run Tasks.find({}); on the front end, I get empty result. It just gives me a long JSON but no data from the database.
In meteor, you can view the documents returned by a cursor by calling fetch on it. For example:
console.log(Tasks.find().fetch());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With