简体   繁体   中英

meteor.js starting example - no collection output

I tried this official tutorial: https://www.meteor.com/tutorials/blaze/collections

I have installed meteor today (v1.2.1) I have not restarted but I restarted explorer.exe, so that meteor's environment variable is known, so that I can use it. I use Windows 10.

So, what I is the following:
1) meteor install --example simple-todos
2) replaced the js code with the js code from the tutorial
3) replaced the html code with the html code from the tutorial
4) replaced the css code with the css code from the tutorial

Now, there is - as expected - no output list. When I insert something into the database via:
1) meteor mongo (same folder as above, of course)
2) db.tasks.insert({text: "lalala"}); with output:

WriteResult({ "nInserted" : 1 })

3) db.tasks.find(); with output:

{ "_id" : ObjectId("56bfa0835701c8a5208bc51d"), "text" : "lalala" }

then I have no update in my browser. F5 does not help.

I have done several tests:
1) console.log(tasks.find({}).fetch()); returns the entry in my command line
2) returning [{text: "test"}] works

I have no clue what I did wrong. Obviously, I am a beginner. Got someone some idea what I could try next?

I got it...

autopublish was not installed per default. If I add it, it'll works. If I remove it, I have to add the publish/subscribe mechanism to get it to work.

Edit: And it was not installed because I used:

meteor create --example simple-todos

instead of

meteor create simple-todos

I confused myself here, my bad.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM