mongo 2.18.1 → 2.18.3
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +1 -1
- data/lib/mongo/bulk_write.rb +6 -4
- data/lib/mongo/client.rb +1 -1
- data/lib/mongo/collection/view/iterable.rb +15 -0
- data/lib/mongo/collection/view/writable.rb +0 -2
- data/lib/mongo/collection/view.rb +1 -0
- data/lib/mongo/collection.rb +150 -45
- data/lib/mongo/crypt/auto_encrypter.rb +1 -0
- data/lib/mongo/crypt/explicit_encrypter.rb +1 -0
- data/lib/mongo/crypt/kms.rb +0 -1
- data/lib/mongo/crypt.rb +11 -0
- data/lib/mongo/error/invalid_read_option.rb +1 -1
- data/lib/mongo/grid/file/chunk.rb +2 -1
- data/lib/mongo/grid/file/info.rb +2 -1
- data/lib/mongo/operation/aggregate.rb +1 -2
- data/lib/mongo/operation/collections_info.rb +3 -15
- data/lib/mongo/operation/command.rb +1 -2
- data/lib/mongo/operation/count.rb +1 -2
- data/lib/mongo/operation/create.rb +1 -2
- data/lib/mongo/operation/create_index.rb +1 -2
- data/lib/mongo/operation/create_user.rb +1 -2
- data/lib/mongo/operation/delete.rb +0 -1
- data/lib/mongo/operation/distinct.rb +1 -2
- data/lib/mongo/operation/drop.rb +1 -2
- data/lib/mongo/operation/drop_database.rb +1 -2
- data/lib/mongo/operation/drop_index.rb +1 -2
- data/lib/mongo/operation/explain.rb +1 -3
- data/lib/mongo/operation/find/builder.rb +0 -1
- data/lib/mongo/operation/find.rb +1 -3
- data/lib/mongo/operation/get_more.rb +1 -3
- data/lib/mongo/operation/indexes.rb +1 -17
- data/lib/mongo/operation/insert.rb +0 -1
- data/lib/mongo/operation/kill_cursors.rb +1 -2
- data/lib/mongo/operation/list_collections.rb +1 -2
- data/lib/mongo/operation/map_reduce.rb +1 -2
- data/lib/mongo/operation/parallel_scan.rb +1 -2
- data/lib/mongo/operation/remove_user.rb +1 -2
- data/lib/mongo/operation/shared/{polymorphic_operation.rb → op_msg_executable.rb} +11 -6
- data/lib/mongo/operation/update.rb +0 -1
- data/lib/mongo/operation/update_user.rb +1 -2
- data/lib/mongo/operation/users_info.rb +1 -2
- data/lib/mongo/operation/write_command.rb +1 -2
- data/lib/mongo/operation.rb +1 -3
- data/lib/mongo/protocol/bit_vector.rb +3 -1
- data/lib/mongo/protocol/caching_hash.rb +3 -20
- data/lib/mongo/protocol/message.rb +4 -8
- data/lib/mongo/protocol/msg.rb +1 -0
- data/lib/mongo/protocol/serializers.rb +24 -17
- data/lib/mongo/protocol.rb +0 -3
- data/lib/mongo/query_cache.rb +20 -20
- data/lib/mongo/server/app_metadata/environment.rb +255 -0
- data/lib/mongo/server/app_metadata/truncator.rb +142 -0
- data/lib/mongo/server/app_metadata.rb +29 -42
- data/lib/mongo/session.rb +1 -1
- data/lib/mongo/version.rb +1 -1
- data/spec/integration/command_spec.rb +1 -23
- data/spec/integration/connection/faas_env_spec.rb +63 -0
- data/spec/integration/find_options_spec.rb +227 -0
- data/spec/integration/ocsp_verifier_spec.rb +1 -1
- data/spec/lite_spec_helper.rb +9 -0
- data/spec/mongo/address_spec.rb +1 -1
- data/spec/mongo/client_construction_spec.rb +7 -7
- data/spec/mongo/client_spec.rb +1 -9
- data/spec/mongo/cluster_spec.rb +2 -2
- data/spec/mongo/collection_crud_spec.rb +56 -0
- data/spec/mongo/collection_spec.rb +11 -1
- data/spec/mongo/crypt/kms_spec.rb +12 -9
- data/spec/mongo/crypt_spec.rb +21 -0
- data/spec/mongo/index/view_spec.rb +1 -0
- data/spec/mongo/protocol/caching_hash_spec.rb +0 -45
- data/spec/mongo/protocol/msg_spec.rb +2 -4
- data/spec/mongo/server/app_metadata/environment_spec.rb +193 -0
- data/spec/mongo/server/app_metadata/truncator_spec.rb +158 -0
- data/spec/mongo/server/app_metadata_spec.rb +33 -47
- data/spec/mongo/socket/ssl_spec.rb +2 -8
- data/spec/runners/crud/requirement.rb +2 -2
- data/spec/shared/lib/mrss/docker_runner.rb +4 -0
- data/spec/shared/lib/mrss/lite_constraints.rb +8 -0
- data/spec/shared/lib/mrss/server_version_registry.rb +16 -23
- data/spec/shared/share/Dockerfile.erb +24 -19
- data/spec/shared/shlib/server.sh +31 -7
- data/spec/shared/shlib/set_env.sh +4 -4
- data/spec/solo/clean_exit_spec.rb +3 -10
- data/spec/spec_tests/data/change_streams_unified/change-streams-showExpandedEvents.yml +15 -6
- data/spec/spec_tests/data/command_monitoring_unified/redacted-commands.yml +8 -0
- data/spec/support/aws_utils.rb +3 -3
- data/spec/support/certificates/atlas-ocsp-ca.crt +67 -67
- data/spec/support/certificates/atlas-ocsp.crt +103 -103
- data/spec/support/shared/app_metadata.rb +14 -2
- data.tar.gz.sig +0 -0
- metadata +1203 -1239
- metadata.gz.sig +0 -0
- data/lib/mongo/operation/aggregate/command.rb +0 -55
- data/lib/mongo/operation/collections_info/command.rb +0 -48
- data/lib/mongo/operation/command/command.rb +0 -41
- data/lib/mongo/operation/count/command.rb +0 -47
- data/lib/mongo/operation/create/command.rb +0 -47
- data/lib/mongo/operation/create_index/command.rb +0 -61
- data/lib/mongo/operation/create_user/command.rb +0 -46
- data/lib/mongo/operation/delete/command.rb +0 -52
- data/lib/mongo/operation/distinct/command.rb +0 -47
- data/lib/mongo/operation/drop/command.rb +0 -41
- data/lib/mongo/operation/drop_database/command.rb +0 -41
- data/lib/mongo/operation/drop_index/command.rb +0 -45
- data/lib/mongo/operation/explain/command.rb +0 -58
- data/lib/mongo/operation/explain/legacy.rb +0 -52
- data/lib/mongo/operation/find/builder/legacy.rb +0 -123
- data/lib/mongo/operation/find/command.rb +0 -51
- data/lib/mongo/operation/find/legacy/result.rb +0 -46
- data/lib/mongo/operation/find/legacy.rb +0 -52
- data/lib/mongo/operation/get_more/command.rb +0 -43
- data/lib/mongo/operation/get_more/legacy.rb +0 -39
- data/lib/mongo/operation/indexes/command.rb +0 -42
- data/lib/mongo/operation/indexes/legacy.rb +0 -48
- data/lib/mongo/operation/insert/command.rb +0 -55
- data/lib/mongo/operation/kill_cursors/command.rb +0 -48
- data/lib/mongo/operation/list_collections/command.rb +0 -46
- data/lib/mongo/operation/map_reduce/command.rb +0 -51
- data/lib/mongo/operation/parallel_scan/command.rb +0 -57
- data/lib/mongo/operation/remove_user/command.rb +0 -46
- data/lib/mongo/operation/shared/op_msg_or_command.rb +0 -41
- data/lib/mongo/operation/shared/op_msg_or_find_command.rb +0 -44
- data/lib/mongo/operation/update/command.rb +0 -53
- data/lib/mongo/operation/update_user/command.rb +0 -45
- data/lib/mongo/operation/users_info/command.rb +0 -46
- data/lib/mongo/operation/write_command/command.rb +0 -51
- data/lib/mongo/protocol/delete.rb +0 -172
- data/lib/mongo/protocol/insert.rb +0 -181
- data/lib/mongo/protocol/update.rb +0 -214
- data/spec/mongo/operation/delete/command_spec.rb +0 -115
- data/spec/mongo/operation/find/legacy_spec.rb +0 -131
- data/spec/mongo/operation/get_more_spec.rb +0 -63
- data/spec/mongo/operation/insert/command_spec.rb +0 -118
- data/spec/mongo/operation/update/command_spec.rb +0 -122
- data/spec/mongo/protocol/delete_spec.rb +0 -185
- data/spec/mongo/protocol/insert_spec.rb +0 -179
- data/spec/mongo/protocol/update_spec.rb +0 -204
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/create/command'
|
|
19
18
|
require 'mongo/operation/create/op_msg'
|
|
20
19
|
|
|
21
20
|
module Mongo
|
|
@@ -28,7 +27,7 @@ module Mongo
|
|
|
28
27
|
# @since 2.0.0
|
|
29
28
|
class Create
|
|
30
29
|
include Specifiable
|
|
31
|
-
include
|
|
30
|
+
include OpMsgExecutable
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
end
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/create_index/command'
|
|
19
18
|
require 'mongo/operation/create_index/op_msg'
|
|
20
19
|
|
|
21
20
|
module Mongo
|
|
@@ -28,7 +27,7 @@ module Mongo
|
|
|
28
27
|
# @since 2.0.0
|
|
29
28
|
class CreateIndex
|
|
30
29
|
include Specifiable
|
|
31
|
-
include
|
|
30
|
+
include OpMsgExecutable
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
end
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/create_user/command'
|
|
19
18
|
require 'mongo/operation/create_user/op_msg'
|
|
20
19
|
|
|
21
20
|
module Mongo
|
|
@@ -28,7 +27,7 @@ module Mongo
|
|
|
28
27
|
# @since 2.0.0
|
|
29
28
|
class CreateUser
|
|
30
29
|
include Specifiable
|
|
31
|
-
include
|
|
30
|
+
include OpMsgExecutable
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
end
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/delete/command'
|
|
19
18
|
require 'mongo/operation/delete/op_msg'
|
|
20
19
|
require 'mongo/operation/delete/result'
|
|
21
20
|
require 'mongo/operation/delete/bulk_result'
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/distinct/command'
|
|
19
18
|
require 'mongo/operation/distinct/op_msg'
|
|
20
19
|
|
|
21
20
|
module Mongo
|
|
@@ -28,7 +27,7 @@ module Mongo
|
|
|
28
27
|
# @since 2.5.0
|
|
29
28
|
class Distinct
|
|
30
29
|
include Specifiable
|
|
31
|
-
include
|
|
30
|
+
include OpMsgExecutable
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
end
|
data/lib/mongo/operation/drop.rb
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/drop/command'
|
|
19
18
|
require 'mongo/operation/drop/op_msg'
|
|
20
19
|
|
|
21
20
|
module Mongo
|
|
@@ -28,7 +27,7 @@ module Mongo
|
|
|
28
27
|
# @since 2.4.0
|
|
29
28
|
class Drop
|
|
30
29
|
include Specifiable
|
|
31
|
-
include
|
|
30
|
+
include OpMsgExecutable
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
end
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/drop_database/command'
|
|
19
18
|
require 'mongo/operation/drop_database/op_msg'
|
|
20
19
|
|
|
21
20
|
module Mongo
|
|
@@ -28,7 +27,7 @@ module Mongo
|
|
|
28
27
|
# @since 2.4.0
|
|
29
28
|
class DropDatabase
|
|
30
29
|
include Specifiable
|
|
31
|
-
include
|
|
30
|
+
include OpMsgExecutable
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
end
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/drop_index/command'
|
|
19
18
|
require 'mongo/operation/drop_index/op_msg'
|
|
20
19
|
|
|
21
20
|
module Mongo
|
|
@@ -28,7 +27,7 @@ module Mongo
|
|
|
28
27
|
# @since 2.0.0
|
|
29
28
|
class DropIndex
|
|
30
29
|
include Specifiable
|
|
31
|
-
include
|
|
30
|
+
include OpMsgExecutable
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
end
|
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
|
|
18
18
|
require 'mongo/operation/explain/result'
|
|
19
19
|
require 'mongo/operation/explain/op_msg'
|
|
20
|
-
require 'mongo/operation/explain/command'
|
|
21
|
-
require 'mongo/operation/explain/legacy'
|
|
22
20
|
|
|
23
21
|
module Mongo
|
|
24
22
|
module Operation
|
|
@@ -30,7 +28,7 @@ module Mongo
|
|
|
30
28
|
# @since 2.5.0
|
|
31
29
|
class Explain
|
|
32
30
|
include Specifiable
|
|
33
|
-
include
|
|
31
|
+
include OpMsgExecutable
|
|
34
32
|
end
|
|
35
33
|
end
|
|
36
34
|
end
|
data/lib/mongo/operation/find.rb
CHANGED
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/find/command'
|
|
19
18
|
require 'mongo/operation/find/op_msg'
|
|
20
|
-
require 'mongo/operation/find/legacy'
|
|
21
19
|
require 'mongo/operation/find/result'
|
|
22
20
|
require 'mongo/operation/find/builder'
|
|
23
21
|
|
|
@@ -31,7 +29,7 @@ module Mongo
|
|
|
31
29
|
# @since 2.0.0
|
|
32
30
|
class Find
|
|
33
31
|
include Specifiable
|
|
34
|
-
include
|
|
32
|
+
include OpMsgExecutable
|
|
35
33
|
end
|
|
36
34
|
end
|
|
37
35
|
end
|
|
@@ -16,9 +16,7 @@
|
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
18
|
require 'mongo/operation/get_more/command_builder'
|
|
19
|
-
require 'mongo/operation/get_more/command'
|
|
20
19
|
require 'mongo/operation/get_more/op_msg'
|
|
21
|
-
require 'mongo/operation/get_more/legacy'
|
|
22
20
|
require 'mongo/operation/get_more/result'
|
|
23
21
|
|
|
24
22
|
module Mongo
|
|
@@ -31,7 +29,7 @@ module Mongo
|
|
|
31
29
|
# @since 2.5.0
|
|
32
30
|
class GetMore
|
|
33
31
|
include Specifiable
|
|
34
|
-
include
|
|
32
|
+
include OpMsgExecutable
|
|
35
33
|
end
|
|
36
34
|
end
|
|
37
35
|
end
|
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/indexes/command'
|
|
19
18
|
require 'mongo/operation/indexes/op_msg'
|
|
20
|
-
require 'mongo/operation/indexes/legacy'
|
|
21
19
|
require 'mongo/operation/indexes/result'
|
|
22
20
|
|
|
23
21
|
module Mongo
|
|
@@ -30,21 +28,7 @@ module Mongo
|
|
|
30
28
|
# @since 2.0.0
|
|
31
29
|
class Indexes
|
|
32
30
|
include Specifiable
|
|
33
|
-
include
|
|
34
|
-
include PolymorphicLookup
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
def final_operation(connection)
|
|
39
|
-
cls = if connection.features.op_msg_enabled?
|
|
40
|
-
polymorphic_class(self.class.name, :OpMsg)
|
|
41
|
-
elsif connection.features.list_indexes_enabled?
|
|
42
|
-
polymorphic_class(self.class.name, :Command)
|
|
43
|
-
else
|
|
44
|
-
polymorphic_class(self.class.name, :Legacy)
|
|
45
|
-
end
|
|
46
|
-
cls.new(spec)
|
|
47
|
-
end
|
|
31
|
+
include OpMsgExecutable
|
|
48
32
|
end
|
|
49
33
|
end
|
|
50
34
|
end
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/insert/command'
|
|
19
18
|
require 'mongo/operation/insert/op_msg'
|
|
20
19
|
require 'mongo/operation/insert/result'
|
|
21
20
|
require 'mongo/operation/insert/bulk_result'
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
18
|
require 'mongo/operation/kill_cursors/command_builder'
|
|
19
|
-
require 'mongo/operation/kill_cursors/command'
|
|
20
19
|
require 'mongo/operation/kill_cursors/op_msg'
|
|
21
20
|
|
|
22
21
|
module Mongo
|
|
@@ -29,7 +28,7 @@ module Mongo
|
|
|
29
28
|
# @since 2.0.0
|
|
30
29
|
class KillCursors
|
|
31
30
|
include Specifiable
|
|
32
|
-
include
|
|
31
|
+
include OpMsgExecutable
|
|
33
32
|
end
|
|
34
33
|
end
|
|
35
34
|
end
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/list_collections/command'
|
|
19
18
|
require 'mongo/operation/list_collections/op_msg'
|
|
20
19
|
require 'mongo/operation/list_collections/result'
|
|
21
20
|
|
|
@@ -29,7 +28,7 @@ module Mongo
|
|
|
29
28
|
# @since 2.0.0
|
|
30
29
|
class ListCollections
|
|
31
30
|
include Specifiable
|
|
32
|
-
include
|
|
31
|
+
include OpMsgExecutable
|
|
33
32
|
end
|
|
34
33
|
end
|
|
35
34
|
end
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/map_reduce/command'
|
|
19
18
|
require 'mongo/operation/map_reduce/op_msg'
|
|
20
19
|
require 'mongo/operation/map_reduce/result'
|
|
21
20
|
|
|
@@ -29,7 +28,7 @@ module Mongo
|
|
|
29
28
|
# @since 2.5.0
|
|
30
29
|
class MapReduce
|
|
31
30
|
include Specifiable
|
|
32
|
-
include
|
|
31
|
+
include OpMsgExecutable
|
|
33
32
|
end
|
|
34
33
|
end
|
|
35
34
|
end
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/parallel_scan/command'
|
|
19
18
|
require 'mongo/operation/parallel_scan/op_msg'
|
|
20
19
|
require 'mongo/operation/parallel_scan/result'
|
|
21
20
|
|
|
@@ -29,7 +28,7 @@ module Mongo
|
|
|
29
28
|
# @since 2.0.0
|
|
30
29
|
class ParallelScan
|
|
31
30
|
include Specifiable
|
|
32
|
-
include
|
|
31
|
+
include OpMsgExecutable
|
|
33
32
|
end
|
|
34
33
|
end
|
|
35
34
|
end
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/remove_user/command'
|
|
19
18
|
require 'mongo/operation/remove_user/op_msg'
|
|
20
19
|
|
|
21
20
|
module Mongo
|
|
@@ -28,7 +27,7 @@ module Mongo
|
|
|
28
27
|
# @since 2.0.0
|
|
29
28
|
class RemoveUser
|
|
30
29
|
include Specifiable
|
|
31
|
-
include
|
|
30
|
+
include OpMsgExecutable
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
# encoding: utf-8
|
|
3
3
|
|
|
4
|
-
# Copyright (C)
|
|
4
|
+
# Copyright (C) 2018-2020 MongoDB Inc.
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
module Mongo
|
|
19
19
|
module Operation
|
|
20
20
|
|
|
21
|
-
# Shared behavior of
|
|
22
|
-
# the server that will be executing the operation.
|
|
21
|
+
# Shared behavior of executing the operation as an OpMsg.
|
|
23
22
|
#
|
|
24
23
|
# @api private
|
|
25
|
-
module
|
|
24
|
+
module OpMsgExecutable
|
|
25
|
+
include PolymorphicLookup
|
|
26
26
|
|
|
27
27
|
# Execute the operation.
|
|
28
28
|
#
|
|
@@ -46,8 +46,13 @@ module Mongo
|
|
|
46
46
|
#
|
|
47
47
|
# @return [ Mongo::Operation::Result ] The operation result.
|
|
48
48
|
def execute_with_connection(connection, context:, options: {})
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
final_operation.execute(connection, context: context, options: options)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
def final_operation
|
|
55
|
+
polymorphic_class(self.class.name, :OpMsg).new(spec)
|
|
51
56
|
end
|
|
52
57
|
end
|
|
53
58
|
end
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/update/command'
|
|
19
18
|
require 'mongo/operation/update/op_msg'
|
|
20
19
|
require 'mongo/operation/update/result'
|
|
21
20
|
require 'mongo/operation/update/bulk_result'
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/update_user/command'
|
|
19
18
|
require 'mongo/operation/update_user/op_msg'
|
|
20
19
|
|
|
21
20
|
module Mongo
|
|
@@ -28,7 +27,7 @@ module Mongo
|
|
|
28
27
|
# @since 2.0.0
|
|
29
28
|
class UpdateUser
|
|
30
29
|
include Specifiable
|
|
31
|
-
include
|
|
30
|
+
include OpMsgExecutable
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
end
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/users_info/command'
|
|
19
18
|
require 'mongo/operation/users_info/op_msg'
|
|
20
19
|
require 'mongo/operation/users_info/result'
|
|
21
20
|
|
|
@@ -29,7 +28,7 @@ module Mongo
|
|
|
29
28
|
# @since 2.0.0
|
|
30
29
|
class UsersInfo
|
|
31
30
|
include Specifiable
|
|
32
|
-
include
|
|
31
|
+
include OpMsgExecutable
|
|
33
32
|
end
|
|
34
33
|
end
|
|
35
34
|
end
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require 'mongo/operation/write_command/command'
|
|
19
18
|
require 'mongo/operation/write_command/op_msg'
|
|
20
19
|
|
|
21
20
|
module Mongo
|
|
@@ -26,7 +25,7 @@ module Mongo
|
|
|
26
25
|
# @api private
|
|
27
26
|
class WriteCommand
|
|
28
27
|
include Specifiable
|
|
29
|
-
include
|
|
28
|
+
include OpMsgExecutable
|
|
30
29
|
end
|
|
31
30
|
end
|
|
32
31
|
end
|
data/lib/mongo/operation.rb
CHANGED
|
@@ -9,7 +9,6 @@ require 'mongo/operation/shared/executable'
|
|
|
9
9
|
require 'mongo/operation/shared/executable_no_validate'
|
|
10
10
|
require 'mongo/operation/shared/executable_transaction_label'
|
|
11
11
|
require 'mongo/operation/shared/polymorphic_lookup'
|
|
12
|
-
require 'mongo/operation/shared/polymorphic_operation'
|
|
13
12
|
require 'mongo/operation/shared/polymorphic_result'
|
|
14
13
|
require 'mongo/operation/shared/read_preference_supported'
|
|
15
14
|
require 'mongo/operation/shared/bypass_document_validation'
|
|
@@ -22,8 +21,7 @@ require 'mongo/operation/shared/idable'
|
|
|
22
21
|
require 'mongo/operation/shared/specifiable'
|
|
23
22
|
require 'mongo/operation/shared/validatable'
|
|
24
23
|
require 'mongo/operation/shared/object_id_generator'
|
|
25
|
-
require 'mongo/operation/shared/
|
|
26
|
-
require 'mongo/operation/shared/op_msg_or_find_command'
|
|
24
|
+
require 'mongo/operation/shared/op_msg_executable'
|
|
27
25
|
|
|
28
26
|
require 'mongo/operation/op_msg_base'
|
|
29
27
|
require 'mongo/operation/command'
|
|
@@ -39,9 +39,11 @@ module Mongo
|
|
|
39
39
|
#
|
|
40
40
|
# @param buffer [ String ] Buffer to receive the serialized vector
|
|
41
41
|
# @param value [ Array<Symbol> ] Array of flags to encode
|
|
42
|
+
# @param [ true, false ] validating_keys Whether keys should be validated when serializing.
|
|
43
|
+
# This option is deprecated and will not be used. It will removed in version 3.0.
|
|
42
44
|
#
|
|
43
45
|
# @return [ String ] Buffer that received the serialized vector
|
|
44
|
-
def serialize(buffer, value, validating_keys =
|
|
46
|
+
def serialize(buffer, value, validating_keys = nil)
|
|
45
47
|
bits = 0
|
|
46
48
|
value.each { |flag| bits |= (@masks[flag] || 0) }
|
|
47
49
|
buffer.put_int32(bits)
|
|
@@ -38,32 +38,15 @@ module Mongo
|
|
|
38
38
|
#
|
|
39
39
|
# @param [ BSON::ByteBuffer ] buffer The encoded BSON buffer to append to.
|
|
40
40
|
# @param [ true, false ] validating_keys Whether keys should be validated when serializing.
|
|
41
|
+
# This option is deprecated and will not be used. It will removed in version 3.0.
|
|
41
42
|
#
|
|
42
43
|
# @return [ BSON::ByteBuffer ] The buffer with the encoded object.
|
|
43
|
-
def to_bson(buffer = BSON::ByteBuffer.new, validating_keys =
|
|
44
|
+
def to_bson(buffer = BSON::ByteBuffer.new, validating_keys = nil)
|
|
44
45
|
if !@bytes
|
|
45
|
-
@bytes = @hash.to_bson(BSON::ByteBuffer.new
|
|
46
|
-
elsif needs_validation?(validating_keys)
|
|
47
|
-
@validated = true
|
|
48
|
-
return @hash.to_bson(buffer, validating_keys)
|
|
46
|
+
@bytes = @hash.to_bson(BSON::ByteBuffer.new).to_s
|
|
49
47
|
end
|
|
50
|
-
@validated ||= validating_keys
|
|
51
48
|
buffer.put_bytes(@bytes)
|
|
52
49
|
end
|
|
53
|
-
|
|
54
|
-
private
|
|
55
|
-
|
|
56
|
-
# Checks the current value for validating keys, and whether or not this
|
|
57
|
-
# bson has been validated in the past, and decides if we need to recalculate
|
|
58
|
-
# the to_bson to check the validations.
|
|
59
|
-
#
|
|
60
|
-
# @param [ true, false ] validating_keys Whether keys should be validated when serializing.
|
|
61
|
-
#
|
|
62
|
-
# @return [ true, false ] Whether or not the bson needs to be recalculated
|
|
63
|
-
# with validation.
|
|
64
|
-
def needs_validation?(validating_keys)
|
|
65
|
-
!@validated && validating_keys
|
|
66
|
-
end
|
|
67
50
|
end
|
|
68
51
|
end
|
|
69
52
|
end
|
|
@@ -354,16 +354,16 @@ module Mongo
|
|
|
354
354
|
if field[:multi]
|
|
355
355
|
value.each do |item|
|
|
356
356
|
if field[:type].respond_to?(:size_limited?)
|
|
357
|
-
field[:type].serialize(buffer, item, max_bson_size
|
|
357
|
+
field[:type].serialize(buffer, item, max_bson_size)
|
|
358
358
|
else
|
|
359
|
-
field[:type].serialize(buffer, item
|
|
359
|
+
field[:type].serialize(buffer, item)
|
|
360
360
|
end
|
|
361
361
|
end
|
|
362
362
|
else
|
|
363
363
|
if field[:type].respond_to?(:size_limited?)
|
|
364
|
-
field[:type].serialize(buffer, value, max_bson_size
|
|
364
|
+
field[:type].serialize(buffer, value, max_bson_size)
|
|
365
365
|
else
|
|
366
|
-
field[:type].serialize(buffer, value
|
|
366
|
+
field[:type].serialize(buffer, value)
|
|
367
367
|
end
|
|
368
368
|
end
|
|
369
369
|
end
|
|
@@ -456,10 +456,6 @@ module Mongo
|
|
|
456
456
|
field[:type].deserialize(io, options)
|
|
457
457
|
)
|
|
458
458
|
end
|
|
459
|
-
|
|
460
|
-
def validating_keys?
|
|
461
|
-
@options[:validating_keys] if @options
|
|
462
|
-
end
|
|
463
459
|
end
|
|
464
460
|
end
|
|
465
461
|
end
|
data/lib/mongo/protocol/msg.rb
CHANGED
|
@@ -58,6 +58,7 @@ module Mongo
|
|
|
58
58
|
# @option options [ true, false ] validating_keys Whether keys should be
|
|
59
59
|
# validated for being valid document keys (i.e. not begin with $ and
|
|
60
60
|
# not contain dots).
|
|
61
|
+
# This option is deprecated and will not be used. It will removed in version 3.0.
|
|
61
62
|
#
|
|
62
63
|
# @api private
|
|
63
64
|
#
|