The default tutorial not working


#1

Hello,

I am following the default tutorial and I am stuck here: https://www.meteor.com/tutorials/blaze/collections

The problem is that I am adding something in the database ( see this screenshot http://prntscr.com/an6cuw ), but it doesn’t show on the frontend.

I come from a frontend and php/mysql background, so it’s a little hard for me to understand the MongoDB concept. I have Windows 10.

Andy idea what the problem might be?

Thanks in advance,
Klevis


#2

Look up Meteor pub/sub:
http://docs.meteor.com/#/full/meteor_publish

https://www.discovermeteor.com/blog/understanding-meteor-publications-and-subscriptions/


#3

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.


#4

any errors? What data do you see in your local db?

The tutorial definitely works correctly


#5

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


#6

@shibbn No error at all. Check this screenshot http://prntscr.com/anjjgo


#7

@vadik This makes sense, but this isn’t in the tutorial…


#8

Just to clarify what @shibbn asked, do you have any errors in the browser?

Could we see your template, too?


#9

@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.”


#10

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.


#11

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.


#12

@vadik here is my code https://github.com/klevismiho/meteortutorial


#13
  1. 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…

  2. 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…


#14

@jbenga I have 2 terminals open. One that is running “meteor” and one “meteor mongo”.


#15

Your server/main.js is wrong

It should contain this line only

import ‘…/imports/api/tasks.js’;


#16

Did you fix it? I’m facing the same error…


#17

@nolapete Thank you very much. That was it!!! So it was entirely my fault. @vsaueia here is the working code https://github.com/klevismiho/meteortutorial


#18

thanks so much, that was my fault too


#19

Thank you, that fixes it, it was my fault all along.


#20

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.