mongo 2.0.0.rc → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +2 -1
  4. data/README.md +1 -4
  5. data/lib/mongo/client.rb +1 -1
  6. data/lib/mongo/collection.rb +1 -1
  7. data/lib/mongo/collection/view.rb +1 -1
  8. data/lib/mongo/collection/view/writable.rb +26 -10
  9. data/lib/mongo/database.rb +1 -1
  10. data/lib/mongo/grid/file.rb +12 -0
  11. data/lib/mongo/grid/file/chunk.rb +1 -1
  12. data/lib/mongo/grid/file/metadata.rb +13 -0
  13. data/lib/mongo/operation/aggregate.rb +1 -1
  14. data/lib/mongo/operation/write.rb +1 -5
  15. data/lib/mongo/operation/write/bulk.rb +17 -0
  16. data/lib/mongo/operation/write/{bulk_delete.rb → bulk/bulk_delete.rb} +1 -1
  17. data/lib/mongo/operation/{bulk_delete → write/bulk/bulk_delete}/result.rb +3 -0
  18. data/lib/mongo/operation/write/{bulk_insert.rb → bulk/bulk_insert.rb} +1 -1
  19. data/lib/mongo/operation/{bulk_insert → write/bulk/bulk_insert}/result.rb +3 -0
  20. data/lib/mongo/operation/write/{bulk_mergable.rb → bulk/bulk_mergable.rb} +0 -0
  21. data/lib/mongo/operation/write/{bulk_update.rb → bulk/bulk_update.rb} +1 -1
  22. data/lib/mongo/operation/{bulk_update → write/bulk/bulk_update}/result.rb +8 -1
  23. data/lib/mongo/operation/write/{legacy_bulk_mergable.rb → bulk/legacy_bulk_mergable.rb} +0 -0
  24. data/lib/mongo/operation/write/delete.rb +2 -0
  25. data/lib/mongo/operation/write/delete/result.rb +40 -0
  26. data/lib/mongo/operation/write/insert.rb +2 -0
  27. data/lib/mongo/operation/write/insert/result.rb +32 -0
  28. data/lib/mongo/operation/write/update.rb +9 -4
  29. data/lib/mongo/operation/write/update/result.rb +160 -0
  30. data/lib/mongo/server/connectable.rb +11 -0
  31. data/lib/mongo/server/connection.rb +1 -0
  32. data/lib/mongo/server/connection_pool.rb +1 -1
  33. data/lib/mongo/server/connection_pool/queue.rb +1 -1
  34. data/lib/mongo/server/monitor.rb +16 -0
  35. data/lib/mongo/server/monitor/connection.rb +1 -0
  36. data/lib/mongo/socket/ssl.rb +30 -8
  37. data/lib/mongo/version.rb +1 -1
  38. data/lib/mongo/write_concern/acknowledged.rb +1 -1
  39. data/lib/mongo/write_concern/unacknowledged.rb +1 -1
  40. data/spec/certificates/ca.pem +17 -0
  41. data/spec/certificates/client.pem +101 -0
  42. data/spec/certificates/crl.pem +10 -0
  43. data/spec/certificates/crl_client_revoked.pem +12 -0
  44. data/spec/certificates/password_protected.pem +51 -0
  45. data/spec/certificates/server.pem +34 -0
  46. data/spec/mongo/collection/view/writable_spec.rb +175 -0
  47. data/spec/mongo/crud_spec.rb +42 -0
  48. data/spec/mongo/grid/file/metadata_spec.rb +23 -0
  49. data/spec/mongo/grid/file_spec.rb +34 -0
  50. data/spec/mongo/operation/write/delete_spec.rb +8 -0
  51. data/spec/mongo/operation/write/insert_spec.rb +21 -8
  52. data/spec/mongo/operation/write/update_spec.rb +52 -1
  53. data/spec/mongo/server/connection_spec.rb +33 -10
  54. data/spec/mongo/server/monitor_spec.rb +14 -0
  55. data/spec/spec_helper.rb +2 -17
  56. data/spec/support/crud.rb +203 -0
  57. data/spec/support/crud/read.rb +144 -0
  58. data/spec/support/crud/write.rb +214 -0
  59. data/spec/support/crud_tests/read/aggregate.yml +43 -0
  60. data/spec/support/crud_tests/read/count.yml +37 -0
  61. data/spec/support/crud_tests/read/distinct.yml +33 -0
  62. data/spec/support/crud_tests/read/find.yml +50 -0
  63. data/spec/support/crud_tests/write/deleteMany.yml +36 -0
  64. data/spec/support/crud_tests/write/deleteOne.yml +49 -0
  65. data/spec/support/crud_tests/write/findOneAndDelete.yml +54 -0
  66. data/spec/support/crud_tests/write/findOneAndReplace.yml +153 -0
  67. data/spec/support/crud_tests/write/findOneAndUpdate.yml +161 -0
  68. data/spec/support/crud_tests/write/insertMany.yml +24 -0
  69. data/spec/support/crud_tests/write/insertOne.yml +19 -0
  70. data/spec/support/crud_tests/write/replaceOne.yml +96 -0
  71. data/spec/support/crud_tests/write/updateMany.yml +83 -0
  72. data/spec/support/crud_tests/write/updateOne.yml +80 -0
  73. metadata +64 -20
  74. metadata.gz.sig +0 -0
  75. data/spec/mongo_orchestration_spec.rb +0 -70
  76. data/spec/support/mongo_orchestration.rb +0 -61
  77. data/spec/support/mongo_orchestration/requestable.rb +0 -109
  78. data/spec/support/mongo_orchestration/standalone.rb +0 -57
@@ -0,0 +1,83 @@
1
+ data:
2
+ - {_id: 1, x: 11}
3
+ - {_id: 2, x: 22}
4
+ - {_id: 3, x: 33}
5
+
6
+ tests:
7
+ -
8
+ description: "UpdateMany when many documents match"
9
+ operation:
10
+ name: "updateMany"
11
+ arguments:
12
+ filter:
13
+ _id: {$gt: 1}
14
+ update:
15
+ $inc: {x: 1}
16
+
17
+ outcome:
18
+ result:
19
+ matchedCount: 2
20
+ modifiedCount: 2
21
+ collection:
22
+ data:
23
+ - {_id: 1, x: 11}
24
+ - {_id: 2, x: 23}
25
+ - {_id: 3, x: 34}
26
+ -
27
+ description: "UpdateMany when one document matches"
28
+ operation:
29
+ name: "updateMany"
30
+ arguments:
31
+ filter: {_id: 1}
32
+ update:
33
+ $inc: {x: 1}
34
+
35
+ outcome:
36
+ result:
37
+ matchedCount: 1
38
+ modifiedCount: 1
39
+ collection:
40
+ data:
41
+ - {_id: 1, x: 12}
42
+ - {_id: 2, x: 22}
43
+ - {_id: 3, x: 33}
44
+ -
45
+ description: "UpdateMany when no documents match"
46
+ operation:
47
+ name: "updateMany"
48
+ arguments:
49
+ filter: {_id: 4}
50
+ update:
51
+ $inc: {x: 1}
52
+
53
+ outcome:
54
+ result:
55
+ matchedCount: 0
56
+ modifiedCount: 0
57
+ collection:
58
+ data:
59
+ - {_id: 1, x: 11}
60
+ - {_id: 2, x: 22}
61
+ - {_id: 3, x: 33}
62
+ -
63
+ description: "UpdateMany with upsert when no documents match"
64
+ operation:
65
+ name: "updateMany"
66
+ arguments:
67
+ filter: {_id: 4}
68
+ update:
69
+ $inc: {x: 1}
70
+ upsert: true
71
+
72
+ outcome:
73
+ result:
74
+ matchedCount: 0
75
+ modifiedCount: 0
76
+ upsertedId: 4
77
+ collection:
78
+ data:
79
+ - {_id: 1, x: 11}
80
+ - {_id: 2, x: 22}
81
+ - {_id: 3, x: 33}
82
+ - {_id: 4, x: 1}
83
+
@@ -0,0 +1,80 @@
1
+ data:
2
+ - {_id: 1, x: 11}
3
+ - {_id: 2, x: 22}
4
+ - {_id: 3, x: 33}
5
+
6
+ tests:
7
+ -
8
+ description: "UpdateOne when many documents match"
9
+ operation:
10
+ name: "updateOne"
11
+ arguments:
12
+ filter:
13
+ _id: {$gt: 1}
14
+ update:
15
+ $inc: {x: 1}
16
+
17
+ outcome:
18
+ result:
19
+ matchedCount: 1
20
+ modifiedCount: 1
21
+ # can't verify collection because we don't have a way
22
+ # of knowing which document gets updated.
23
+ -
24
+ description: "UpdateOne when one document matches"
25
+ operation:
26
+ name: "updateOne"
27
+ arguments:
28
+ filter: {_id: 1}
29
+ update:
30
+ $inc: {x: 1}
31
+
32
+ outcome:
33
+ result:
34
+ matchedCount: 1
35
+ modifiedCount: 1
36
+ collection:
37
+ data:
38
+ - {_id: 1, x: 12}
39
+ - {_id: 2, x: 22}
40
+ - {_id: 3, x: 33}
41
+ -
42
+ description: "UpdateOne when no documents match"
43
+ operation:
44
+ name: "updateOne"
45
+ arguments:
46
+ filter: {_id: 4}
47
+ update:
48
+ $inc: {x: 1}
49
+
50
+ outcome:
51
+ result:
52
+ matchedCount: 0
53
+ modifiedCount: 0
54
+ collection:
55
+ data:
56
+ - {_id: 1, x: 11}
57
+ - {_id: 2, x: 22}
58
+ - {_id: 3, x: 33}
59
+ -
60
+ description: "UpdateOne with upsert when no documents match"
61
+ operation:
62
+ name: "updateOne"
63
+ arguments:
64
+ filter: {_id: 4}
65
+ update:
66
+ $inc: {x: 1}
67
+ upsert: true
68
+
69
+ outcome:
70
+ result:
71
+ matchedCount: 0
72
+ modifiedCount: 0
73
+ upsertedId: 4
74
+ collection:
75
+ data:
76
+ - {_id: 1, x: 11}
77
+ - {_id: 2, x: 22}
78
+ - {_id: 3, x: 33}
79
+ - {_id: 4, x: 1}
80
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Brock
@@ -32,7 +32,7 @@ cert_chain:
32
32
  o2UXDbWtz5PqoFd8EgNJAn3+BG1pwC9S9pVFG3WPucfAx/bE8iq/vvchHei5Y/Vo
33
33
  aAz5f/hY4zFeYWvGDBHYEXE1rTN2hhMSyJscPcFbmz0=
34
34
  -----END CERTIFICATE-----
35
- date: 2015-03-17 00:00:00.000000000 Z
35
+ date: 2015-03-25 00:00:00.000000000 Z
36
36
  dependencies:
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: bson
@@ -144,9 +144,6 @@ files:
144
144
  - lib/mongo/operation.rb
145
145
  - lib/mongo/operation/aggregate.rb
146
146
  - lib/mongo/operation/aggregate/result.rb
147
- - lib/mongo/operation/bulk_delete/result.rb
148
- - lib/mongo/operation/bulk_insert/result.rb
149
- - lib/mongo/operation/bulk_update/result.rb
150
147
  - lib/mongo/operation/command.rb
151
148
  - lib/mongo/operation/executable.rb
152
149
  - lib/mongo/operation/kill_cursors.rb
@@ -166,10 +163,15 @@ files:
166
163
  - lib/mongo/operation/result.rb
167
164
  - lib/mongo/operation/specifiable.rb
168
165
  - lib/mongo/operation/write.rb
169
- - lib/mongo/operation/write/bulk_delete.rb
170
- - lib/mongo/operation/write/bulk_insert.rb
171
- - lib/mongo/operation/write/bulk_mergable.rb
172
- - lib/mongo/operation/write/bulk_update.rb
166
+ - lib/mongo/operation/write/bulk.rb
167
+ - lib/mongo/operation/write/bulk/bulk_delete.rb
168
+ - lib/mongo/operation/write/bulk/bulk_delete/result.rb
169
+ - lib/mongo/operation/write/bulk/bulk_insert.rb
170
+ - lib/mongo/operation/write/bulk/bulk_insert/result.rb
171
+ - lib/mongo/operation/write/bulk/bulk_mergable.rb
172
+ - lib/mongo/operation/write/bulk/bulk_update.rb
173
+ - lib/mongo/operation/write/bulk/bulk_update/result.rb
174
+ - lib/mongo/operation/write/bulk/legacy_bulk_mergable.rb
173
175
  - lib/mongo/operation/write/command.rb
174
176
  - lib/mongo/operation/write/command/create_index.rb
175
177
  - lib/mongo/operation/write/command/create_user.rb
@@ -182,11 +184,13 @@ files:
182
184
  - lib/mongo/operation/write/create_index.rb
183
185
  - lib/mongo/operation/write/create_user.rb
184
186
  - lib/mongo/operation/write/delete.rb
187
+ - lib/mongo/operation/write/delete/result.rb
185
188
  - lib/mongo/operation/write/drop_index.rb
186
189
  - lib/mongo/operation/write/insert.rb
187
- - lib/mongo/operation/write/legacy_bulk_mergable.rb
190
+ - lib/mongo/operation/write/insert/result.rb
188
191
  - lib/mongo/operation/write/remove_user.rb
189
192
  - lib/mongo/operation/write/update.rb
193
+ - lib/mongo/operation/write/update/result.rb
190
194
  - lib/mongo/options.rb
191
195
  - lib/mongo/options/mapper.rb
192
196
  - lib/mongo/protocol.rb
@@ -232,6 +236,12 @@ files:
232
236
  - lib/mongo/write_concern/normalizable.rb
233
237
  - lib/mongo/write_concern/unacknowledged.rb
234
238
  - mongo.gemspec
239
+ - spec/certificates/ca.pem
240
+ - spec/certificates/client.pem
241
+ - spec/certificates/crl.pem
242
+ - spec/certificates/crl_client_revoked.pem
243
+ - spec/certificates/password_protected.pem
244
+ - spec/certificates/server.pem
235
245
  - spec/mongo/address/ipv4_spec.rb
236
246
  - spec/mongo/address/ipv6_spec.rb
237
247
  - spec/mongo/address/unix_spec.rb
@@ -258,6 +268,7 @@ files:
258
268
  - spec/mongo/collection/view/writable_spec.rb
259
269
  - spec/mongo/collection/view_spec.rb
260
270
  - spec/mongo/collection_spec.rb
271
+ - spec/mongo/crud_spec.rb
261
272
  - spec/mongo/cursor_spec.rb
262
273
  - spec/mongo/database_spec.rb
263
274
  - spec/mongo/error/parser_spec.rb
@@ -325,14 +336,27 @@ files:
325
336
  - spec/mongo/uri_spec.rb
326
337
  - spec/mongo/write_concern/acknowledged_spec.rb
327
338
  - spec/mongo/write_concern/unacknowledged_spec.rb
328
- - spec/mongo_orchestration_spec.rb
329
339
  - spec/spec_helper.rb
330
340
  - spec/support/authorization.rb
341
+ - spec/support/crud.rb
342
+ - spec/support/crud/read.rb
343
+ - spec/support/crud/write.rb
344
+ - spec/support/crud_tests/read/aggregate.yml
345
+ - spec/support/crud_tests/read/count.yml
346
+ - spec/support/crud_tests/read/distinct.yml
347
+ - spec/support/crud_tests/read/find.yml
348
+ - spec/support/crud_tests/write/deleteMany.yml
349
+ - spec/support/crud_tests/write/deleteOne.yml
350
+ - spec/support/crud_tests/write/findOneAndDelete.yml
351
+ - spec/support/crud_tests/write/findOneAndReplace.yml
352
+ - spec/support/crud_tests/write/findOneAndUpdate.yml
353
+ - spec/support/crud_tests/write/insertMany.yml
354
+ - spec/support/crud_tests/write/insertOne.yml
355
+ - spec/support/crud_tests/write/replaceOne.yml
356
+ - spec/support/crud_tests/write/updateMany.yml
357
+ - spec/support/crud_tests/write/updateOne.yml
331
358
  - spec/support/helpers.rb
332
359
  - spec/support/matchers.rb
333
- - spec/support/mongo_orchestration.rb
334
- - spec/support/mongo_orchestration/requestable.rb
335
- - spec/support/mongo_orchestration/standalone.rb
336
360
  - spec/support/sdam/rs/discover_arbiters.yml
337
361
  - spec/support/sdam/rs/discover_passives.yml
338
362
  - spec/support/sdam/rs/discover_primary.yml
@@ -423,9 +447,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
423
447
  version: '0'
424
448
  required_rubygems_version: !ruby/object:Gem::Requirement
425
449
  requirements:
426
- - - ">"
450
+ - - ">="
427
451
  - !ruby/object:Gem::Version
428
- version: 1.3.1
452
+ version: '0'
429
453
  requirements: []
430
454
  rubyforge_project: mongo
431
455
  rubygems_version: 2.2.2
@@ -433,6 +457,12 @@ signing_key:
433
457
  specification_version: 4
434
458
  summary: Ruby driver for MongoDB
435
459
  test_files:
460
+ - spec/certificates/ca.pem
461
+ - spec/certificates/client.pem
462
+ - spec/certificates/crl.pem
463
+ - spec/certificates/crl_client_revoked.pem
464
+ - spec/certificates/password_protected.pem
465
+ - spec/certificates/server.pem
436
466
  - spec/mongo/address/ipv4_spec.rb
437
467
  - spec/mongo/address/ipv6_spec.rb
438
468
  - spec/mongo/address/unix_spec.rb
@@ -459,6 +489,7 @@ test_files:
459
489
  - spec/mongo/collection/view/writable_spec.rb
460
490
  - spec/mongo/collection/view_spec.rb
461
491
  - spec/mongo/collection_spec.rb
492
+ - spec/mongo/crud_spec.rb
462
493
  - spec/mongo/cursor_spec.rb
463
494
  - spec/mongo/database_spec.rb
464
495
  - spec/mongo/error/parser_spec.rb
@@ -526,14 +557,27 @@ test_files:
526
557
  - spec/mongo/uri_spec.rb
527
558
  - spec/mongo/write_concern/acknowledged_spec.rb
528
559
  - spec/mongo/write_concern/unacknowledged_spec.rb
529
- - spec/mongo_orchestration_spec.rb
530
560
  - spec/spec_helper.rb
531
561
  - spec/support/authorization.rb
562
+ - spec/support/crud/read.rb
563
+ - spec/support/crud/write.rb
564
+ - spec/support/crud.rb
565
+ - spec/support/crud_tests/read/aggregate.yml
566
+ - spec/support/crud_tests/read/count.yml
567
+ - spec/support/crud_tests/read/distinct.yml
568
+ - spec/support/crud_tests/read/find.yml
569
+ - spec/support/crud_tests/write/deleteMany.yml
570
+ - spec/support/crud_tests/write/deleteOne.yml
571
+ - spec/support/crud_tests/write/findOneAndDelete.yml
572
+ - spec/support/crud_tests/write/findOneAndReplace.yml
573
+ - spec/support/crud_tests/write/findOneAndUpdate.yml
574
+ - spec/support/crud_tests/write/insertMany.yml
575
+ - spec/support/crud_tests/write/insertOne.yml
576
+ - spec/support/crud_tests/write/replaceOne.yml
577
+ - spec/support/crud_tests/write/updateMany.yml
578
+ - spec/support/crud_tests/write/updateOne.yml
532
579
  - spec/support/helpers.rb
533
580
  - spec/support/matchers.rb
534
- - spec/support/mongo_orchestration/requestable.rb
535
- - spec/support/mongo_orchestration/standalone.rb
536
- - spec/support/mongo_orchestration.rb
537
581
  - spec/support/sdam/rs/discover_arbiters.yml
538
582
  - spec/support/sdam/rs/discover_passives.yml
539
583
  - spec/support/sdam/rs/discover_primary.yml
metadata.gz.sig CHANGED
Binary file
@@ -1,70 +0,0 @@
1
- require 'spec_helper'
2
-
3
- #describe MongoOrchestration, if: mongo_orchestration_available? do
4
- #
5
- # context 'when creating a standalone' do
6
- #
7
- # context 'when the mongo orchestration service is available' do
8
- #
9
- # before do
10
- # initialize_mo_standalone!
11
- # end
12
- #
13
- # after do
14
- # stop_mo_standalone!
15
- # end
16
- #
17
- # it 'sets up a standalone object with an id' do
18
- # expect(@standalone.id).to_not be_nil
19
- # end
20
- #
21
- # it 'sets up a standalone object with a client' do
22
- # expect(@standalone.client).to_not be_nil
23
- # end
24
- #
25
- # it 'sets the correct cluster topology' do
26
- # expect(@standalone.client.cluster.topology).to eq(Mongo::Cluster::Topology::Standalone)
27
- # end
28
- #
29
- # it 'sets the path' do
30
- # expect(@standalone.path).to eq(MongoOrchestration::DEFAULT_BASE_URI)
31
- # end
32
- # end
33
- #
34
- # context 'when the mongo orchestration service is not available' do
35
- #
36
- # it 'raises an error' do
37
- # expect do
38
- # initialize_mo_standalone!('http://localhost:1')
39
- # end.to raise_exception(MongoOrchestration::ServiceNotAvailable)
40
- # end
41
- # end
42
- # end
43
- #
44
- # context 'when stopping a standalone' do
45
- #
46
- # before do
47
- # initialize_mo_standalone!
48
- # stop_mo_standalone!
49
- # end
50
- #
51
- # it 'stops the standalone' do
52
- # expect(@standalone.alive?).to eq(false)
53
- # end
54
- # end
55
- #
56
- # context 'when making a direct request' do
57
- #
58
- # before do
59
- # initialize_mo_standalone!
60
- # end
61
- #
62
- # after do
63
- # stop_mo_standalone!
64
- # end
65
- #
66
- # it 'returns the response' do
67
- # expect(@standalone.request('GET', 'servers').class).to be(HTTParty::Response)
68
- # end
69
- # end
70
- #end
@@ -1,61 +0,0 @@
1
- # Copyright (C) 2009-2014 MongoDB, Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require 'support/mongo_orchestration/requestable'
16
- require 'support/mongo_orchestration/standalone'
17
-
18
- module MongoOrchestration
19
-
20
- extend self
21
-
22
- TYPES = {
23
- standalone: Standalone,
24
- #replica_set: ReplicaSet,
25
- #sharded_cluster: ShardedCluster
26
- }
27
-
28
- # The default base uri for mongo orchestration.
29
- #
30
- # @since 2.0.0
31
- DEFAULT_BASE_URI = 'http://localhost:8889'.freeze
32
-
33
-
34
- # Get a Mongo Orchestration resource.
35
- #
36
- # @example Get the Mongo Orchestration resource.
37
- # MongoOrchestration.get(:standalone)
38
- #
39
- # @param [ Symbol ] type The type of resource.
40
- # @param [ Hash ] options Options for creating the resource.
41
- #
42
- # @option options [ String ] :path The path to use for the
43
- # Mongo Orchestration service.
44
- #
45
- # @return [ Standlone, ReplicaSet, ShardedCluster ] The resource.
46
- #
47
- # @since 2.0.0
48
- def get(type, options = {})
49
- TYPES[type].new(options)
50
- end
51
-
52
- # Raised when the Mongo Orchestration service is not available.
53
- #
54
- # @since 2.0.0
55
- class ServiceNotAvailable < RuntimeError
56
-
57
- def initialize
58
- super("The Mongo Orchestration service is not available.")
59
- end
60
- end
61
- end