Skip to content

Commit

Permalink
Fix "wrong number of arguments" error when shipping events to MongoDB (
Browse files Browse the repository at this point in the history
…fixes #60, #64, #65) (#66)

Add missing second argument to to_bson methods, introduced with underlying Mongo driver update (fixes issues #60, #64, #65)
  • Loading branch information
rmmorrison authored Jan 31, 2022
1 parent a969cee commit f6d3a73
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 3.1.7
- Fix "wrong number of arguments" error when shipping events to MongoDB (fixes #60, #64, #65) [#66](https://github.com/logstash-plugins/logstash-output-mongodb/pull/66)

## 3.1.6
- Fixes BigDecimal and Timestamp encoding and update driver to v2.6 [#59](https://github.com/logstash-plugins/logstash-output-mongodb/pull/59)

Expand Down
2 changes: 1 addition & 1 deletion lib/logstash/outputs/bson/big_decimal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module BigDecimal
# 1.221311.to_bson
# @return [ String ] The encoded string.
# @see http://bsonspec.org/#/specification
def to_bson(buffer = ByteBuffer.new)
def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
buffer.put_bytes([ self ].pack(PACK))
end

Expand Down
2 changes: 1 addition & 1 deletion lib/logstash/outputs/bson/logstash_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module LogStashEvent
# Event.new("field" => "value").to_bson
# @return [ String ] The encoded string.
# @see http://bsonspec.org/#/specification
def to_bson(buffer = ByteBuffer.new)
def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
position = buffer.length
buffer.put_int32(0)
to_hash.each do |field, value|
Expand Down
2 changes: 1 addition & 1 deletion lib/logstash/outputs/bson/logstash_timestamp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module LogStashTimestamp
# A time is type 0x09 in the BSON spec.
BSON_TYPE = 9.chr.force_encoding(BINARY).freeze

def to_bson(buffer = ByteBuffer.new)
def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
time.to_bson(buffer)
end

Expand Down
2 changes: 1 addition & 1 deletion logstash-output-mongodb.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'logstash-output-mongodb'
s.version = '3.1.6'
s.version = '3.1.7'
s.licenses = ['Apache License (2.0)']
s.summary = "Writes events to MongoDB"
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
Expand Down

0 comments on commit f6d3a73

Please sign in to comment.