em-mongo 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/em-mongo.rb CHANGED
@@ -7,7 +7,7 @@ module EM::Mongo
7
7
  module Version
8
8
  MAJOR = 0
9
9
  MINOR = 2
10
- TINY = 6
10
+ TINY = 7
11
11
  STRING = [MAJOR, MINOR, TINY].join('.')
12
12
  end
13
13
 
@@ -81,8 +81,8 @@ module EM::Mongo
81
81
  flags += 2 if options[:multi]
82
82
  message.put_int(flags)
83
83
 
84
- message.put_array(BSON::BSON_CODER.serialize(selector, false, true).to_a)
85
- message.put_array(BSON::BSON_CODER.serialize(document, true, true).to_a)
84
+ message.put_array(BSON::BSON_CODER.serialize(selector, true, true).to_a)
85
+ message.put_array(BSON::BSON_CODER.serialize(document, false, true).to_a)
86
86
 
87
87
  req_id = new_request_id
88
88
  message.prepend!(message_headers(OP_UPDATE, req_id, message))
@@ -87,6 +87,17 @@ describe EMMongo::Collection do
87
87
  end
88
88
  end
89
89
 
90
+ it 'should update an object with $inc' do
91
+ EM::Spec::Mongo.collection do |collection|
92
+ obj = collection.insert('hello' => 'world')
93
+ collection.update({'hello' => 'world'}, {'$inc' => {'count' => 1}})
94
+ collection.find({'_id' => obj['_id']},{}) do |res|
95
+ res.first['hello'].should == 'world'
96
+ res.first['count'].should == 1
97
+ EM::Spec::Mongo.close
98
+ end
99
+ end
100
+ end
90
101
 
91
102
  it 'should remove an object' do
92
103
  EM::Spec::Mongo.collection do |collection|
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 6
9
- version: 0.2.6
8
+ - 7
9
+ version: 0.2.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - bcg