lib/fluent/plugin/out_mongo.rb in fluent-plugin-mongo-0.5.2 vs lib/fluent/plugin/out_mongo.rb in fluent-plugin-mongo-0.5.3

- old
+ new

@@ -58,11 +58,11 @@ @clients.values.each { |client| client.db.connection.close } super end def format(tag, time, record) - record.to_msgpack + [time, record].to_msgpack end def write(chunk) operate(@collection, collect_records(chunk)) end @@ -81,11 +81,11 @@ get_or_create_collection(collection_name).insert(records) end def collect_records(chunk) records = [] - chunk.msgpack_each { |record| - record[@time_key] = Time.at(record[@time_key]) if @include_time_key + chunk.msgpack_each { |time, record| + record[@time_key] = Time.at(time || record[@time_key]) if @include_time_key records << record } records end