I have a more clear picture of it, but I still don’t understand what I am doing wrong and why my data of this tutorial doesn’t display when I add it to the database.
When following this section you only define your collection on server side, so that’s the reason why you can’t access it from your client side. I recommend you to install Mongol package and then to import your collection in your let’s say client.js file then just visit your 3000 port and hit Ctrl + M and you should be able to see your collection definded on client side
@klevismiho I have the exact same problem, OSX Yosemite, inserted tasks following tutorial, and confirmed that collection was created. But nothing shows on frontend. @vadik what you said makes sense, but according to the tutorial, we wouldn’t need to. Here’s a quote of the tutorial right after the step of inserting tasks:
“In your web browser, you will see the UI of your app immediately update to show the new task. You can see that we didn’t have to write any code to connect the server-side database to our front-end code — it just happened automatically.”
Well guys, I think everyone (for example I’m on Linux) faces this so called issue which is not issue at all imo. “…write any code to connect the server-side database to our front-end code” - that doesn’t mean we should actually have our db defined on the client side, it means that since this step we can create new documents and they’ll appear on the screen (i.e front-end) on this particular step right after mongo query in our terminals, so you can just push your code on github and give a link here so we can look up and tell you what can be wrong. I followed this tutorial to make sure there is no errors and everything worked for me. But for now not seeing your code I’d definetly recommend you to check your imports one more time if you follow MDG’s app structure, I guess it’s the most common mistake to be made.
A mistake that I’ve made and I’m sure others have made is not removing code from the previous step. There are three files connected with this step in section 3 when you remove the hardcoded tasks and implement the Mongo tasks.
3.1 imports/api/tasks.js
3.2 server/main.js
3.3 imports/ui/body.js
Make sure these files contain ONLY the code that is in each of those sections. If it doesn’t match exactly, it is not going to work. If you have extra code left behind from the hardcoded tasks, it will not work either.
When you run ‘meteor mongo’ as noted at step 3 in the tutorial, it should be run in a new terminal tab at your app’s directory (yes, you need to be at your app’s directory again in this new terminal tab); and while running ‘meteor mongo’ in this new (second) terminal tab, ‘meteor’ should still be running your app in the FIRST terminal tab…
If in the scenario that step 1 is followed as noted above (it should be, only then will you be able to do a db insert?), then try refreshing your browser to see the updated task…
a click on the link causes navigation,
a right-button mouse click shows the context menu,
enter on a form field cases it’s submission to the server, etc.