Skip to content

Instantly share code, notes, and snippets.

@skippy
Created November 19, 2009 21:32
Show Gist options
  • Select an option

  • Save skippy/239063 to your computer and use it in GitHub Desktop.

Select an option

Save skippy/239063 to your computer and use it in GitHub Desktop.
c = MongoMapper.database.collection('system.js')
c.save(:_id => 'sdc_test', :value => Mongo::Code.new("function(x, y){ print('within method'); return x + y + 2}"))
MongoMapper.database.eval(Mongo::Code.new('sdc_test(x,y)', :x => 3, :y => 2))
# should see 'witin method' in /var/log/mongodb/output.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment