File: rubygems.rb

package info (click to toggle)
ruby-em-mongo 0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 320 kB
  • sloc: ruby: 2,728; makefile: 2
file content (19 lines) | stat: -rwxr-xr-x 366 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env ruby

require "rubygems"
require "eventmachine"
require "em-mongo"

$return = -1

EM.run do
  @conn = EM::Mongo::Connection.new
  EM.next_tick do
    id = @conn.db.collection('test').insert({:hello => "world"})
    @conn.db.collection('test').first(:_id => id) do |document|
      $return = 0 if document
      EM.stop
    end
  end
end
exit($return)