lib/mongo/protocol/msg.rb in mongo-2.15.0.alpha vs lib/mongo/protocol/msg.rb in mongo-2.15.0

- old
+ new

@@ -1,5 +1,8 @@ +# frozen_string_literal: true +# encoding: utf-8 + # Copyright (C) 2017-2020 MongoDB Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -38,15 +41,15 @@ INTERNAL_KEYS = Set.new(%w($clusterTime $db lsid signature txnNumber)).freeze # Creates a new OP_MSG protocol message # # @example Create a OP_MSG wire protocol message - # Msg.new([:more_to_come], {}, { ismaster: 1 }, + # Msg.new([:more_to_come], {}, { hello: 1 }, # { type: 1, payload: { identifier: 'documents', sequence: [..] } }) # - # @param [ Array<Symbol> ] flags The flag bits. Current supported values - # are :more_to_come and :checksum_present. + # @param [ Array<Symbol> ] flags The flag bits. Currently supported + # values are :more_to_come and :checksum_present. # @param [ Hash ] options The options. # @param [ BSON::Document, Hash ] main_document The document that will # become the payload type 0 section. Can contain global args as they # are defined in the OP_MSG specification. # @param [ Protocol::Msg::Section1 ] sequences Zero or more payload type 1 @@ -194,11 +197,11 @@ # Possibly encrypt this message with libmongocrypt. Message will only be # encrypted if the specified client exists, that client has been given # auto-encryption options, the client has not been instructed to bypass # auto-encryption, and mongocryptd determines that this message is # eligible for encryption. A message is eligible for encryption if it - # represents one of the command types whitelisted by libmongocrypt and it + # represents one of the command types allow-listed by libmongocrypt and it # contains data that is required to be encrypted by a local or remote json schema. # # @param [ Mongo::Server::Connection ] connection The connection on which # the operation is performed. # @param [ Mongo::Operation::Context ] context The operation context. @@ -233,11 +236,11 @@ # Possibly decrypt this message with libmongocrypt. Message will only be # decrypted if the specified client exists, that client has been given # auto-encryption options, and this message is eligible for decryption. # A message is eligible for decryption if it represents one of the command - # types whitelisted by libmongocrypt and it contains data that is required + # types allow-listed by libmongocrypt and it contains data that is required # to be encrypted by a local or remote json schema. # # @param [ Mongo::Operation::Context ] context The operation context. # # @return [ Mongo::Protocol::Msg ] The decrypted message, or the original @@ -274,14 +277,9 @@ num_inserts > 1 || num_updates > 1 || num_deletes > 1 end def maybe_add_server_api(server_api) - if @main_document[:getMore] - # getMore does not allow API parameters. - return self - end - conflicts = {} %i(apiVersion apiStrict apiDeprecationErrors).each do |key| if @main_document.key?(key) conflicts[key] = @main_document[key] end