simplified example
This commit is contained in:
parent
011280282d
commit
5cdf60f157
|
@ -11,14 +11,7 @@ db = Mongo.new(host, port).db('ruby-mongo-examples-simple')
|
||||||
coll = db.collection('test')
|
coll = db.collection('test')
|
||||||
coll.clear
|
coll.clear
|
||||||
|
|
||||||
doc = {'a' => 1}
|
3.times { |i| coll.insert({'a' => i+1}) }
|
||||||
coll.insert(doc)
|
|
||||||
|
|
||||||
doc = {'a' => 2}
|
|
||||||
coll.insert(doc)
|
|
||||||
|
|
||||||
doc = {'a' => 3}
|
|
||||||
coll.insert(doc)
|
|
||||||
|
|
||||||
puts "There are #{coll.count()} records in the test collection. Here they are:"
|
puts "There are #{coll.count()} records in the test collection. Here they are:"
|
||||||
coll.find().each { |doc| puts doc.inspect }
|
coll.find().each { |doc| puts doc.inspect }
|
||||||
|
|
Loading…
Reference in New Issue