Calculated field with Meteor and MongoDB

My dating app has this function where I rank user based on an algorithm which takes their last login date, and some other ‘factors’.

I thought this was gonna be easy. Well, it would’ve been if I wanted to take the entire collection to the client, the use JS to calculate the field, sort, and display to user.

Problem is, I can’t load the entire collection. That’s thousands of users. I have to sort BEFORE I return the result. Which means I have to sort at the database level before I return the results, which was quite challenging.

Continue reading

Payments with PayPal IPN and Meteor

First of all, if you need to do payment with Meteor, I’d highly recommend using Stripe or Braintree. Their API is much simpler, better UX, everything … so why am I using PayPal?

Well Stripe is not in my country, and Braintree beta rejected our application because it’s a dating website!!!! *face palm*

Anyways, without much other choice, I went with the PayPal basic payment HTML form, submit to pay on their site, and return data with IPN (Instant Payment Notifications). It’s friggin stone-age technology but heck it still works.

Continue reading

image drag and drop upload to Amazon S3 with Meteor

Image upload is one of those pretty daunting things for beginner programmer (myself before I finish this). Luckily good folks that use meteor has already done the bulk of the work for us.

However, it’s still no simple feat to put it all together. I used the dropzone.js package for the drag-and-drop client-side image handling, then use CollectionFS to handle storing image record in database and upload to Amazon S3 as well.

There’s also a great package someone wrote to compress and correct orientation, saved my life! : ccorcos:clientside-image-manipulation.

Continue reading