Retrieving Data from Meteor Collections

前端 未结 5 1334
北恋
北恋 2021-02-08 18:54

I\'m having a few problems when trying to get data from a Meteor Collection and I need some advice.

The collection has been defined, published, and subscribed successful

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-08 19:24

    Your results for find() and findOne() are consistent. Basically, Mongo or minimongo is simply not finding a document that matches that _id. FindOne() is precisely like doing a find(selector, options).fetch()[0].

    Your Lists.Projects template is likely expecting a collection, array or hash it can iterate over. You cannot return one specific document. If you are using {{#each Projects}} you must provide some way for the template to iterate not just a single value.

提交回复
热议问题