Mongo data is frozen on server side


#1

I’m making a mongo query on the server side, but once I add data in the db, the next time I refresh the page, the data hasn’t been updated, only gets updated if I restart the server.


const Picture = new Mongo.Collection('picture')

if (Meteor.isServer) {
    var list= Picture.find({}).fetch();
    console.log(list);//the data is the same after db changes
}

#2

If you refresh the page it will not refresh the server as well. If you restart your server, you will see your data.


#3

How can I refresh the data without restarting the server?


#4

What is your end-goal what are you trying to do ? The code you provided is only run once when you start Meteor. That’s it. I wrote some tutorials www.meteor-tuts.com maybe they will help you!


#5

I need to get data on the server and pass it to the client on render, this is because is an isomorphic app


#6

You’ve probably skipped a lot of the basic knowledge you need. Why not start with one of the “to do app” tutorials?


#7

I did but as I started to implement server side rendering, the to do app was not good enough, solved it by using a cursor observer on the data that I need to be updated on the server side