How to upload database to meteor.com

If you want to upload your local db to replay.meteor.com(replace replay.meteor.com with yourapp.meteor.com), follow the following steps:

Step 1, create 3 scripts file: export.sh, showdb.sh, restore.sh

For export.sh, write:

mongodump -h 127.0.0.1:82 -d meteor -o meteor
#port is 82 because I am running the local meteor at 80
#port should be your local port + 2, so the default would be 3000+2 = 3002

For showdb.sh, write:

meteor mongo --url replay.meteor.com

For restore.sh, write:

mongorestore -u client -p $1 -h production-db-a1.meteor.io:27017 -db replay_meteor_com meteor/meteor/ --objcheck --drop
#production-db-a1.meteor.io is the physical server and might be different for your app

Step 2:

sh export.sh
#this will export your db into a local file

Step 3:

sh showdb.sh
#output should be
#mongodb://client:d2f3d2a0-73eb-f641-a41b-e12517cb5a2a@production-db-a1.meteor.io:27017/replay_meteor_com
#copy d2f3d2a0-73eb-f641-a41b-e12517cb5a2a to your clipboard

Step 4:

sh restore.sh d2f3d2a0-73eb-f641-a41b-e12517cb5a2a
#that should get the local file and restore it to the server
#WARNING: it will drop your remote db at meteor.com

Note:

– The ‘d2f3d2a0-73eb-f641-a41b-e12517cb5a2a’ seems to work only once and expires in a minute. So, hurry up

– Pay attention to the server address since they do change from time to time

Standard

Day 23, week 3 assessment

Another “self-assessment” in the morning and the code review is already handed back by dansitu. Good job, dansitu. Overall, good. However, I had to look at my old Backbone code to figure out the right syntax… I should really start a new project with Backbone.

Hao and I were extremely efficient with our Node.js sprint and we were done with the extra credit before lunch. Awesome!!! Shawn did some live coding to show us his approach to the Node.js sprint and I loved his coding style. Well structured and with the right amount of code for readability. I should strive for that style.

With an entire afternoon to spare, I managed to spend more time with my meteor app. Made some progress and please refer to another blog post for how to upload database to meteor.com

Standard

Day 21, no more auto publish with Meteor.com

Besides grocery shopping, I finally got rid of autopublish for one of my Meteor projects.

With Meteor, it is incredibly easy to get things up and running. By default, Meteor autopublish everything in your collection to clients. It works perfectly until your collection / database becomes too large to download for the client. I am at this moment now.

It was daunting at the beginning, but I manged to get it through. According to my very limited knowledge, it seemed to work like this:

Step 1, remove autopublish:


meteor remove autopublish

Step 2, at the server side, publish the collection

Meteor.publish('pics_filtered', function(filter){
return Pics.find({day:filter});
});
Step 3, at the client side, catch the collection.

Pics = new Meteor.Collection('pics');
Session.set('today_filter', 17);
Deps.autorun(function () {
Meteor.subscribe("pics_filtered", Session.get("today_filter"));
});

Step 4, there is no step 4. It seems like Deps.autorun() was responsible for catch and bind data to the collection at client side. Still not 100% sure though.

I have to vent. Look at the following specifications for JS….

– setMonth Sets the month (0-11) for a specified date according to local time.

– setDate Sets the day of the month (1-31) for a specified date according to local time.

Standard