Updated .merge() method to take function in RethinkDb