Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-2562

Allow dot in key fields

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: bson-4.12.0
    • Component/s: BSON
    • None

      Since MongoDB 3.6.1, dot(`.`) in fields is allowed.

      But, current bson gem does not allow dot in fields as follows with fluent-plugin-mongo:

      2021-03-25 15:22:01 +0900 [warn]: #0 failed to flush the buffer. retry_time=0 next_retry_seconds=2021-03-25 15:22:02.994075 +0900 chunk="5be566ee166e20d02ef619900ed8184a" error_class=BSON::String::IllegalKey error="'key.message' is an illegal key in MongoDB. Keys may not start with '$' or contain a '.'."
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/bson-4.12.0/lib/bson/hash.rb:42:in `put_hash'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/bson-4.12.0/lib/bson/hash.rb:42:in `to_bson'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/protocol/serializers.rb:358:in `serialize'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/protocol/serializers.rb:317:in `block in serialize'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/protocol/serializers.rb:316:in `each'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/protocol/serializers.rb:316:in `serialize'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/protocol/serializers.rb:194:in `block in serialize'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/protocol/serializers.rb:187:in `each'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/protocol/serializers.rb:187:in `serialize'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/protocol/message.rb:343:in `block in serialize_fields'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/protocol/message.rb:331:in `each'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/protocol/message.rb:331:in `serialize_fields'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/protocol/message.rb:192:in `serialize'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/protocol/msg.rb:152:in `serialize'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/shared/sessions_supported.rb:230:in `block in build_message'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/shared/sessions_supported.rb:225:in `tap'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/shared/sessions_supported.rb:225:in `build_message'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/shared/executable.rb:61:in `dispatch_message'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/insert/op_msg.rb:35:in `get_result'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/shared/executable.rb:29:in `block (3 levels) in do_execute'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/shared/response_handling.rb:96:in `add_server_diagnostics'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/shared/executable.rb:28:in `block (2 levels) in do_execute'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/shared/response_handling.rb:43:in `add_error_labels'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/shared/executable.rb:27:in `block in do_execute'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/shared/response_handling.rb:82:in `unpin_maybe'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/shared/executable.rb:26:in `do_execute'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/shared/executable_no_validate.rb:25:in `execute'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/shared/write.rb:74:in `bulk_execute'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/bulk_write.rb:228:in `insert_one'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/bulk_write.rb:189:in `block in execute_operation'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/operation/shared/response_handling.rb:82:in `unpin_maybe'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/bulk_write.rb:185:in `execute_operation'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/bulk_write.rb:66:in `block (4 levels) in execute'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/server/connection_pool.rb:590:in `with_connection'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/server.rb:425:in `with_connection'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/bulk_write.rb:65:in `block (3 levels) in execute'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/retryable.rb:293:in `legacy_write_with_retry'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/retryable.rb:202:in `write_with_retry'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/.rbenv/versions/2.7.1/lib/ruby/2.7.0/forwardable.rb:235:in `write_with_retry'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/bulk_write.rb:64:in `block (2 levels) in execute'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/bulk_write.rb:61:in `each'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/bulk_write.rb:61:in `block in execute'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/client.rb:1018:in `with_session'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/bulk_write.rb:60:in `execute'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/collection.rb:606:in `bulk_write'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/mongo-2.13.2/lib/mongo/collection.rb:583:in `insert_many'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/lib/fluent/plugin/out_mongo.rb:334:in `operate'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/lib/fluent/plugin/out_mongo.rb:197:in `write'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/fluentd-1.12.1/lib/fluent/plugin/output.rb:1136:in `try_flush'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/fluentd-1.12.1/lib/fluent/plugin/output.rb:1448:in `flush_thread_run'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/fluentd-1.12.1/lib/fluent/plugin/output.rb:462:in `block (2 levels) in start'
      2021-03-25 15:22:01 +0900 [warn]: #0 /Users/cosmo/GitHub/fluent-plugin-mongo/vendor/bundle/ruby/2.7.0/gems/fluentd-1.12.1/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'

       

      mongo-ruby-driver and its dependent bson gem should support dot in field key.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            cosmo0920.oucc@gmail.com hiroshi hatake
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: