logstash-output-mongodb 3.1.5 → 3.1.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a80fe32d5f3500dadd616df40cbf18fdb09678d4c2501d7a5514662cf6934b87
4
- data.tar.gz: ca57807a9e2a897d6b2d4177735c58a7a2ac8db5f156148393f5e8ae6694584f
3
+ metadata.gz: ae7d9464a6eab8fbc58602c60641316f01d63c5e48ec451575136900b27b4f89
4
+ data.tar.gz: cf82873af70224bc6c7aa1500cedfaed2dfbf4e0cdb09ed446eae19f9b9e0850
5
5
  SHA512:
6
- metadata.gz: 338736bbad3f0f3f7bea52c42afbf820490308f4c66de9918c30ab87ec65f3a8dc143cf2466de117c5ed747a604fe7ea5d34255914ecb47cd235593aaa7d8fce
7
- data.tar.gz: 44f24d65baec8b345730066a17fa0c329d8b6d8109f50c5f50351abb4902d0c68f4d8af54d9f42556c65b0724975bf2426f16e59150f3fa3f0971d78c133206d
6
+ metadata.gz: d33c1fd05f9d7f9dc267e7c98119b976d58dd6f574306e449d63b550b89307c04b4ae92aece6ae3a5c5fbb90ae50ae93c05536cec40e58c7b7daa5ecf6826f85
7
+ data.tar.gz: 8310ea2c1edc2d16ed11792d61401a5c8517b815a3ecbf99623cf7a29f1117b06eaa2fb726d275ec2713ab13df56f5e477a758f0041bcbde116c4c924162b52d
@@ -1,3 +1,6 @@
1
+ ## 3.1.6
2
+ - Fixes BigDecimal and Timestamp encoding and update driver to v2.6 [#59](https://github.com/logstash-plugins/logstash-output-mongodb/pull/59)
3
+
1
4
  ## 3.1.5
2
5
  - Fixed @timestamp handling, BSON::ObjectId generation, close method [#57](https://github.com/logstash-plugins/logstash-output-mongodb/pull/57)
3
6
 
@@ -33,8 +33,8 @@ module BSON
33
33
  # 1.221311.to_bson
34
34
  # @return [ String ] The encoded string.
35
35
  # @see http://bsonspec.org/#/specification
36
- def to_bson(encoded = ''.force_encoding(BINARY))
37
- encoded << [ self ].pack(PACK)
36
+ def to_bson(buffer = ByteBuffer.new)
37
+ buffer.put_bytes([ self ].pack(PACK))
38
38
  end
39
39
 
40
40
  module ClassMethods
@@ -44,7 +44,7 @@ module BSON
44
44
  # @return [ BigDecimal ] The decoded BigDecimal.
45
45
  # @see http://bsonspec.org/#/specification
46
46
  def from_bson(bson)
47
- from_bson_double(bson.read(8))
47
+ from_bson_double(bson.get_bytes(8))
48
48
  end
49
49
 
50
50
  private
@@ -25,8 +25,8 @@ module BSON
25
25
  # A time is type 0x09 in the BSON spec.
26
26
  BSON_TYPE = 9.chr.force_encoding(BINARY).freeze
27
27
 
28
- def to_bson(encoded = ''.force_encoding(BINARY))
29
- time.to_bson(encoded)
28
+ def to_bson(buffer = ByteBuffer.new)
29
+ time.to_bson(buffer)
30
30
  end
31
31
 
32
32
  module ClassMethods
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-mongodb'
3
- s.version = '3.1.5'
3
+ s.version = '3.1.6'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "Writes events to MongoDB"
6
6
  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"
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  # Gem dependencies
22
22
  s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
23
23
  s.add_runtime_dependency 'logstash-codec-plain'
24
- s.add_runtime_dependency 'mongo', '~> 2.0.6'
24
+ s.add_runtime_dependency 'mongo', '~> 2.6'
25
25
 
26
26
  s.add_development_dependency 'logstash-devutils'
27
27
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'bigdecimal'
3
3
  require_relative "../spec_helper"
4
- require 'stringio'
5
4
 
6
5
  describe ::BigDecimal do
7
6
  let(:a_number) { "4321.1234" }
@@ -13,8 +12,8 @@ describe ::BigDecimal do
13
12
  expect(subject).to respond_to(:to_bson)
14
13
  end
15
14
 
16
- it "to_bson returns a binary encoded number" do
17
- expect(subject.to_bson).to eq(4321.1234.to_bson)
15
+ it "to_bson returns a binary encoded number which can be encoded back from bson" do
16
+ expect(BigDecimal::from_bson(subject.to_bson)).to eq(BigDecimal::from_bson(4321.1234.to_bson))
18
17
  end
19
18
 
20
19
  it "bson_type returns a binary encoded 1" do
@@ -23,7 +22,7 @@ describe ::BigDecimal do
23
22
 
24
23
  describe "class methods" do
25
24
  it "builds a new BigDecimal from BSON" do
26
- decoded = described_class.from_bson(StringIO.new(4321.1234.to_bson))
25
+ decoded = described_class.from_bson(4321.1234.to_bson)
27
26
  expect(decoded).to eql(BigDecimal.new(a_number))
28
27
  end
29
28
  end
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
  require_relative "../spec_helper"
3
- require 'stringio'
4
3
 
5
4
  describe ::LogStash::Timestamp do
6
5
  let(:time_array) { [1918,11,11,11,0,0, "+00:00"] }
@@ -13,8 +12,8 @@ describe ::LogStash::Timestamp do
13
12
  expect(subject).to respond_to(:to_bson)
14
13
  end
15
14
 
16
- it "to_bson returns a binary encoded timestamp" do
17
- expect(timestamp.to_bson).to eq(bson_time)
15
+ it "to_bson returns a binary encoded timestamp which may be encoded back from bson" do
16
+ expect(Time::from_bson(timestamp.to_bson)).to eq(Time::from_bson(bson_time))
18
17
  end
19
18
 
20
19
  it "bson_type returns a binary encoded 9" do
@@ -24,7 +23,7 @@ describe ::LogStash::Timestamp do
24
23
  describe "class methods" do
25
24
  it "builds a new Timestamp from BSON" do
26
25
  expected = ::LogStash::Timestamp.new(a_time)
27
- decoded = ::LogStash::Timestamp.from_bson(StringIO.new(bson_time))
26
+ decoded = ::LogStash::Timestamp.from_bson(bson_time)
28
27
  expect(decoded <=> expected).to eq(0)
29
28
  end
30
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-mongodb
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.5
4
+ version: 3.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-25 00:00:00.000000000 Z
11
+ date: 2019-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: 2.0.6
52
+ version: '2.6'
53
53
  name: mongo
54
54
  prerelease: false
55
55
  type: :runtime
@@ -57,7 +57,7 @@ dependencies:
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 2.0.6
60
+ version: '2.6'
61
61
  - !ruby/object:Gem::Dependency
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements: