diff --git a/Makefile b/Makefile index 1d806ed8c1d..7e9360b95df 100644 --- a/Makefile +++ b/Makefile @@ -73,3 +73,4 @@ examples-python: curl -SfL https://raw.githubusercontent.com/mongodb/mongo-python-driver/master/test/test_examples.py -o ${DRIVERS_PATH}/test_examples.py curl -SfL https://raw.githubusercontent.com/mongodb/mongo-perl-driver/master/t/examples/driver-examples.t -o ${DRIVERS_PATH}/driver-examples.t curl -SfL https://raw.githubusercontent.com/mongodb/mongo-php-library/master/tests/DocumentationExamplesTest.php -o ${DRIVERS_PATH}/DocumentationExamplesTest.php + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-ruby-driver/master/spec/mongo/shell_examples_spec.rb -o ${DRIVERS_PATH}/shell_examples_spec.rb diff --git a/conf.py b/conf.py index 9cd3d1c5743..209850a2d7b 100644 --- a/conf.py +++ b/conf.py @@ -81,8 +81,8 @@ def has(self, *args): 'opsmgr': ('https://docs.opsmanager.mongodb.com/current%s', ''), 'products': ('https://www.mongodb.com/products%s', ''), 'wtdocs': ('http://source.wiredtiger.com/mongodb-3.4%s', ''), - 'perl-api': ('https://metacpan.org/pod/MongoDB::%s', '') - + 'perl-api': ('https://metacpan.org/pod/MongoDB::%s', ''), + 'ruby-api': ('http://api.mongodb.com/ruby/current/Mongo/%s', '') } ## add `extlinks` for each published version. diff --git a/source/includes/driver-example-delete-55.rst b/source/includes/driver-example-delete-55.rst index facac723af9..e454ea597b8 100644 --- a/source/includes/driver-example-delete-55.rst +++ b/source/includes/driver-example-delete-55.rst @@ -46,3 +46,12 @@ :dedent: 4 :start-after: Start Example 55 :end-before: End Example 55 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 6 + :start-after: Start Example 55 + :end-before: End Example 55 diff --git a/source/includes/driver-example-delete-56.rst b/source/includes/driver-example-delete-56.rst index 1f5cc6bd9c1..fa92fef8e7e 100644 --- a/source/includes/driver-example-delete-56.rst +++ b/source/includes/driver-example-delete-56.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 56 :end-before: End Example 56 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 56 + :end-before: End Example 56 diff --git a/source/includes/driver-example-delete-57.rst b/source/includes/driver-example-delete-57.rst index 5c961d11379..0c30455d186 100644 --- a/source/includes/driver-example-delete-57.rst +++ b/source/includes/driver-example-delete-57.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 57 :end-before: End Example 57 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 57 + :end-before: End Example 57 diff --git a/source/includes/driver-example-delete-58.rst b/source/includes/driver-example-delete-58.rst index a182d66f39b..68f5ffea445 100644 --- a/source/includes/driver-example-delete-58.rst +++ b/source/includes/driver-example-delete-58.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 58 :end-before: End Example 58 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 58 + :end-before: End Example 58 diff --git a/source/includes/driver-example-delete-result.rst b/source/includes/driver-example-delete-result.rst index d265d294e04..b297c3fab9b 100644 --- a/source/includes/driver-example-delete-result.rst +++ b/source/includes/driver-example-delete-result.rst @@ -31,3 +31,12 @@ :perl-api:`MongoDB::DeleteResult` whose ``deleted_count`` attribute contains the number of documents that matched the filter. + + - id: ruby + content: | + Upon successful execution, the + :ruby-api:`delete_many()` method + returns an instance of + :ruby-api:`Mongo::Operation::Result`, whose + ``deleted_count`` attribute contains the number of documents + that matched the filter. diff --git a/source/includes/driver-example-insert-1.rst b/source/includes/driver-example-insert-1.rst index 69d3ed8dc97..c61aeeb25fe 100644 --- a/source/includes/driver-example-insert-1.rst +++ b/source/includes/driver-example-insert-1.rst @@ -42,3 +42,12 @@ :dedent: 4 :start-after: Start Example 1 :end-before: End Example 1 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 6 + :start-after: Start Example 1 + :end-before: End Example 1 diff --git a/source/includes/driver-example-insert-2.rst b/source/includes/driver-example-insert-2.rst index 626ecb6d342..695a613de3c 100644 --- a/source/includes/driver-example-insert-2.rst +++ b/source/includes/driver-example-insert-2.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 2 :end-before: End Example 2 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 2 + :end-before: End Example 2 diff --git a/source/includes/driver-example-insert-3.rst b/source/includes/driver-example-insert-3.rst index 50217d31b72..e05b89f68d0 100644 --- a/source/includes/driver-example-insert-3.rst +++ b/source/includes/driver-example-insert-3.rst @@ -44,3 +44,12 @@ :dedent: 4 :start-after: Start Example 3 :end-before: End Example 3 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 3 + :end-before: End Example 3 diff --git a/source/includes/driver-example-query-10.rst b/source/includes/driver-example-query-10.rst index 6eedc7fb7ae..348925f01ab 100644 --- a/source/includes/driver-example-query-10.rst +++ b/source/includes/driver-example-query-10.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 10 :end-before: End Example 10 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 10 + :end-before: End Example 10 diff --git a/source/includes/driver-example-query-11.rst b/source/includes/driver-example-query-11.rst index 8a31834088e..4b107086e29 100644 --- a/source/includes/driver-example-query-11.rst +++ b/source/includes/driver-example-query-11.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 11 :end-before: End Example 11 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 11 + :end-before: End Example 11 diff --git a/source/includes/driver-example-query-12.rst b/source/includes/driver-example-query-12.rst index df67f8a0f4f..4e22708ebf2 100644 --- a/source/includes/driver-example-query-12.rst +++ b/source/includes/driver-example-query-12.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 12 :end-before: End Example 12 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 12 + :end-before: End Example 12 diff --git a/source/includes/driver-example-query-13.rst b/source/includes/driver-example-query-13.rst index 0c8e5a221d5..6380f1f27ca 100644 --- a/source/includes/driver-example-query-13.rst +++ b/source/includes/driver-example-query-13.rst @@ -38,3 +38,12 @@ :dedent: 4 :start-after: Start Example 13 :end-before: End Example 13 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 13 + :end-before: End Example 13 diff --git a/source/includes/driver-example-query-14.rst b/source/includes/driver-example-query-14.rst index d550f59318e..4d00831ec02 100644 --- a/source/includes/driver-example-query-14.rst +++ b/source/includes/driver-example-query-14.rst @@ -46,3 +46,12 @@ :dedent: 4 :start-after: Start Example 14 :end-before: End Example 14 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 6 + :start-after: Start Example 14 + :end-before: End Example 14 \ No newline at end of file diff --git a/source/includes/driver-example-query-15.rst b/source/includes/driver-example-query-15.rst index f90c271d534..2efd685fa4f 100644 --- a/source/includes/driver-example-query-15.rst +++ b/source/includes/driver-example-query-15.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 15 :end-before: End Example 15 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 15 + :end-before: End Example 15 \ No newline at end of file diff --git a/source/includes/driver-example-query-16.rst b/source/includes/driver-example-query-16.rst index 5f5b8f849e6..6dc884c65e3 100644 --- a/source/includes/driver-example-query-16.rst +++ b/source/includes/driver-example-query-16.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 16 :end-before: End Example 16 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 16 + :end-before: End Example 16 \ No newline at end of file diff --git a/source/includes/driver-example-query-17.rst b/source/includes/driver-example-query-17.rst index eb5c2b7015f..65cc8d69b4b 100644 --- a/source/includes/driver-example-query-17.rst +++ b/source/includes/driver-example-query-17.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 17 :end-before: End Example 17 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 17 + :end-before: End Example 17 \ No newline at end of file diff --git a/source/includes/driver-example-query-18.rst b/source/includes/driver-example-query-18.rst index 767874607bc..affe8ea10c3 100644 --- a/source/includes/driver-example-query-18.rst +++ b/source/includes/driver-example-query-18.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 18 :end-before: End Example 18 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 18 + :end-before: End Example 18 \ No newline at end of file diff --git a/source/includes/driver-example-query-19.rst b/source/includes/driver-example-query-19.rst index e9ad7cec9f3..1bb62cac066 100644 --- a/source/includes/driver-example-query-19.rst +++ b/source/includes/driver-example-query-19.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 19 :end-before: End Example 19 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 19 + :end-before: End Example 19 \ No newline at end of file diff --git a/source/includes/driver-example-query-20.rst b/source/includes/driver-example-query-20.rst index 6aa85966de4..135d2baaec4 100644 --- a/source/includes/driver-example-query-20.rst +++ b/source/includes/driver-example-query-20.rst @@ -46,3 +46,12 @@ :dedent: 4 :start-after: Start Example 20 :end-before: End Example 20 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 6 + :start-after: Start Example 20 + :end-before: End Example 20 \ No newline at end of file diff --git a/source/includes/driver-example-query-21.rst b/source/includes/driver-example-query-21.rst index 9e30e721e35..9e94008800c 100644 --- a/source/includes/driver-example-query-21.rst +++ b/source/includes/driver-example-query-21.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 21 :end-before: End Example 21 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 21 + :end-before: End Example 21 \ No newline at end of file diff --git a/source/includes/driver-example-query-22.rst b/source/includes/driver-example-query-22.rst index 23089ddf6e6..ea9a17a8c56 100644 --- a/source/includes/driver-example-query-22.rst +++ b/source/includes/driver-example-query-22.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 22 :end-before: End Example 22 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 22 + :end-before: End Example 22 \ No newline at end of file diff --git a/source/includes/driver-example-query-23.rst b/source/includes/driver-example-query-23.rst index 5ee750c26e4..ac4d3f86307 100644 --- a/source/includes/driver-example-query-23.rst +++ b/source/includes/driver-example-query-23.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 23 :end-before: End Example 23 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 23 + :end-before: End Example 23 \ No newline at end of file diff --git a/source/includes/driver-example-query-24.rst b/source/includes/driver-example-query-24.rst index 6d26b1c39de..9d5943cec78 100644 --- a/source/includes/driver-example-query-24.rst +++ b/source/includes/driver-example-query-24.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 24 :end-before: End Example 24 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 24 + :end-before: End Example 24 \ No newline at end of file diff --git a/source/includes/driver-example-query-25.rst b/source/includes/driver-example-query-25.rst index 384a0b5c1fa..80ac19904e9 100644 --- a/source/includes/driver-example-query-25.rst +++ b/source/includes/driver-example-query-25.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 25 :end-before: End Example 25 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 25 + :end-before: End Example 25 \ No newline at end of file diff --git a/source/includes/driver-example-query-26.rst b/source/includes/driver-example-query-26.rst index 59b4a261268..d8a5edf39ab 100644 --- a/source/includes/driver-example-query-26.rst +++ b/source/includes/driver-example-query-26.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 26 :end-before: End Example 26 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 26 + :end-before: End Example 26 \ No newline at end of file diff --git a/source/includes/driver-example-query-27.rst b/source/includes/driver-example-query-27.rst index 5419c4cae93..1faa9fab1e0 100644 --- a/source/includes/driver-example-query-27.rst +++ b/source/includes/driver-example-query-27.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 27 :end-before: End Example 27 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 27 + :end-before: End Example 27 \ No newline at end of file diff --git a/source/includes/driver-example-query-28.rst b/source/includes/driver-example-query-28.rst index b9ba48b1786..df2555ea162 100644 --- a/source/includes/driver-example-query-28.rst +++ b/source/includes/driver-example-query-28.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 28 :end-before: End Example 28 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 28 + :end-before: End Example 28 \ No newline at end of file diff --git a/source/includes/driver-example-query-29.rst b/source/includes/driver-example-query-29.rst index dc180e2b1d2..d854878d994 100644 --- a/source/includes/driver-example-query-29.rst +++ b/source/includes/driver-example-query-29.rst @@ -46,3 +46,12 @@ :dedent: 4 :start-after: Start Example 29 :end-before: End Example 29 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 6 + :start-after: Start Example 29 + :end-before: End Example 29 \ No newline at end of file diff --git a/source/includes/driver-example-query-30.rst b/source/includes/driver-example-query-30.rst index 22eac023b72..abd4a90836b 100644 --- a/source/includes/driver-example-query-30.rst +++ b/source/includes/driver-example-query-30.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 30 :end-before: End Example 30 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 30 + :end-before: End Example 30 \ No newline at end of file diff --git a/source/includes/driver-example-query-31.rst b/source/includes/driver-example-query-31.rst index f617e39fc08..e9788a9460f 100644 --- a/source/includes/driver-example-query-31.rst +++ b/source/includes/driver-example-query-31.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 31 :end-before: End Example 31 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 31 + :end-before: End Example 31 \ No newline at end of file diff --git a/source/includes/driver-example-query-32.rst b/source/includes/driver-example-query-32.rst index 86c504ec7fc..d5d30ef9d6c 100644 --- a/source/includes/driver-example-query-32.rst +++ b/source/includes/driver-example-query-32.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 32 :end-before: End Example 32 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 32 + :end-before: End Example 32 \ No newline at end of file diff --git a/source/includes/driver-example-query-33.rst b/source/includes/driver-example-query-33.rst index fb96b737bad..53110918c17 100644 --- a/source/includes/driver-example-query-33.rst +++ b/source/includes/driver-example-query-33.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 33 :end-before: End Example 33 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 33 + :end-before: End Example 33 \ No newline at end of file diff --git a/source/includes/driver-example-query-34.rst b/source/includes/driver-example-query-34.rst index c04a7d7f05e..e9375b01691 100644 --- a/source/includes/driver-example-query-34.rst +++ b/source/includes/driver-example-query-34.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 34 :end-before: End Example 34 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 34 + :end-before: End Example 34 \ No newline at end of file diff --git a/source/includes/driver-example-query-35.rst b/source/includes/driver-example-query-35.rst index c419741a942..9cda2eb4fbb 100644 --- a/source/includes/driver-example-query-35.rst +++ b/source/includes/driver-example-query-35.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 35 :end-before: End Example 35 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 35 + :end-before: End Example 35 \ No newline at end of file diff --git a/source/includes/driver-example-query-36.rst b/source/includes/driver-example-query-36.rst index ebc535575ff..3d39a91f8b0 100644 --- a/source/includes/driver-example-query-36.rst +++ b/source/includes/driver-example-query-36.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 36 :end-before: End Example 36 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 36 + :end-before: End Example 36 \ No newline at end of file diff --git a/source/includes/driver-example-query-37.rst b/source/includes/driver-example-query-37.rst index b8ee4eda4b7..9caeb297a3d 100644 --- a/source/includes/driver-example-query-37.rst +++ b/source/includes/driver-example-query-37.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 37 :end-before: End Example 37 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 37 + :end-before: End Example 37 \ No newline at end of file diff --git a/source/includes/driver-example-query-38.rst b/source/includes/driver-example-query-38.rst index fb34c38572a..ee65cbeb9f2 100644 --- a/source/includes/driver-example-query-38.rst +++ b/source/includes/driver-example-query-38.rst @@ -43,3 +43,12 @@ :dedent: 4 :start-after: Start Example 38 :end-before: End Example 38 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 6 + :start-after: Start Example 38 + :end-before: End Example 38 \ No newline at end of file diff --git a/source/includes/driver-example-query-39.rst b/source/includes/driver-example-query-39.rst index a92f457169e..27a1f4a1021 100644 --- a/source/includes/driver-example-query-39.rst +++ b/source/includes/driver-example-query-39.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 39 :end-before: End Example 39 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 39 + :end-before: End Example 39 diff --git a/source/includes/driver-example-query-40.rst b/source/includes/driver-example-query-40.rst index a56dd77edc8..41d6f9d8ff0 100644 --- a/source/includes/driver-example-query-40.rst +++ b/source/includes/driver-example-query-40.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 40 :end-before: End Example 40 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 40 + :end-before: End Example 40 \ No newline at end of file diff --git a/source/includes/driver-example-query-41.rst b/source/includes/driver-example-query-41.rst index 054cbc46482..b9688ad703b 100644 --- a/source/includes/driver-example-query-41.rst +++ b/source/includes/driver-example-query-41.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 41 :end-before: End Example 41 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 41 + :end-before: End Example 41 \ No newline at end of file diff --git a/source/includes/driver-example-query-42.rst b/source/includes/driver-example-query-42.rst index 6958b7b8b0c..bcca51dab5c 100644 --- a/source/includes/driver-example-query-42.rst +++ b/source/includes/driver-example-query-42.rst @@ -46,3 +46,12 @@ :dedent: 4 :start-after: Start Example 42 :end-before: End Example 42 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 6 + :start-after: Start Example 42 + :end-before: End Example 42 \ No newline at end of file diff --git a/source/includes/driver-example-query-43.rst b/source/includes/driver-example-query-43.rst index 2421962b11d..cd7ada3b61a 100644 --- a/source/includes/driver-example-query-43.rst +++ b/source/includes/driver-example-query-43.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 43 :end-before: End Example 43 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 43 + :end-before: End Example 43 \ No newline at end of file diff --git a/source/includes/driver-example-query-44.rst b/source/includes/driver-example-query-44.rst index 53eced4c0cb..eb184cd19fe 100644 --- a/source/includes/driver-example-query-44.rst +++ b/source/includes/driver-example-query-44.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 44 :end-before: End Example 44 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 44 + :end-before: End Example 44 \ No newline at end of file diff --git a/source/includes/driver-example-query-45.rst b/source/includes/driver-example-query-45.rst index e828841d332..66c1b40ec44 100644 --- a/source/includes/driver-example-query-45.rst +++ b/source/includes/driver-example-query-45.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 45 :end-before: End Example 45 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 45 + :end-before: End Example 45 \ No newline at end of file diff --git a/source/includes/driver-example-query-46.rst b/source/includes/driver-example-query-46.rst index 8e1a4de7659..7442a7f873c 100644 --- a/source/includes/driver-example-query-46.rst +++ b/source/includes/driver-example-query-46.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 46 :end-before: End Example 46 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 46 + :end-before: End Example 46 \ No newline at end of file diff --git a/source/includes/driver-example-query-47.rst b/source/includes/driver-example-query-47.rst index 9c1d7147e7f..3dcf4e942ea 100644 --- a/source/includes/driver-example-query-47.rst +++ b/source/includes/driver-example-query-47.rst @@ -37,3 +37,12 @@ :dedent: 4 :start-after: Start Example 47 :end-before: End Example 47 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 47 + :end-before: End Example 47 \ No newline at end of file diff --git a/source/includes/driver-example-query-48.rst b/source/includes/driver-example-query-48.rst index a7ef5348393..23e174a753f 100644 --- a/source/includes/driver-example-query-48.rst +++ b/source/includes/driver-example-query-48.rst @@ -37,3 +37,12 @@ :dedent: 4 :start-after: Start Example 48 :end-before: End Example 48 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 48 + :end-before: End Example 48 \ No newline at end of file diff --git a/source/includes/driver-example-query-49.rst b/source/includes/driver-example-query-49.rst index 9143d527498..fd6d4a3a27a 100644 --- a/source/includes/driver-example-query-49.rst +++ b/source/includes/driver-example-query-49.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 49 :end-before: End Example 49 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 49 + :end-before: End Example 49 \ No newline at end of file diff --git a/source/includes/driver-example-query-50.rst b/source/includes/driver-example-query-50.rst index 2d2564b5448..f967b0eb832 100644 --- a/source/includes/driver-example-query-50.rst +++ b/source/includes/driver-example-query-50.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 50 :end-before: End Example 50 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 50 + :end-before: End Example 50 \ No newline at end of file diff --git a/source/includes/driver-example-query-6.rst b/source/includes/driver-example-query-6.rst index b3c3f4f4cb4..57f97eed192 100644 --- a/source/includes/driver-example-query-6.rst +++ b/source/includes/driver-example-query-6.rst @@ -46,3 +46,12 @@ :dedent: 4 :start-after: Start Example 6 :end-before: End Example 6 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 6 + :start-after: Start Example 6 + :end-before: End Example 6 diff --git a/source/includes/driver-example-query-7.rst b/source/includes/driver-example-query-7.rst index a8b5efc9de4..dee40bd0f7b 100644 --- a/source/includes/driver-example-query-7.rst +++ b/source/includes/driver-example-query-7.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 7 :end-before: End Example 7 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 7 + :end-before: End Example 7 diff --git a/source/includes/driver-example-query-9.rst b/source/includes/driver-example-query-9.rst index eb0255078a0..944230f9e62 100644 --- a/source/includes/driver-example-query-9.rst +++ b/source/includes/driver-example-query-9.rst @@ -34,3 +34,12 @@ :dedent: 4 :start-after: Start Example 9 :end-before: End Example 9 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 9 + :end-before: End Example 9 diff --git a/source/includes/driver-example-query-intro.rst b/source/includes/driver-example-query-intro.rst index c6abc4d19ce..e2897f4a777 100644 --- a/source/includes/driver-example-query-intro.rst +++ b/source/includes/driver-example-query-intro.rst @@ -35,3 +35,12 @@ `MongoDB Perl Driver `_. The examples on this page use the ``inventory`` collection. To populate the ``inventory`` collection, run the following: + + - id: ruby + content: | + This page provides examples of |query_operations| using the + :ruby-api:`Mongo::Collection#find()` + method in the + `MongoDB Ruby Driver `_. + The examples on this page use the ``inventory`` collection. To + populate the ``inventory`` collection, run the following: diff --git a/source/includes/driver-example-update-51.rst b/source/includes/driver-example-update-51.rst index f85c97572c9..ba2be18513d 100644 --- a/source/includes/driver-example-update-51.rst +++ b/source/includes/driver-example-update-51.rst @@ -51,3 +51,12 @@ :dedent: 4 :start-after: Start Example 51 :end-before: End Example 51 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 6 + :start-after: Start Example 51 + :end-before: End Example 51 diff --git a/source/includes/driver-example-update-52.rst b/source/includes/driver-example-update-52.rst index 42559904672..95714ec91b4 100644 --- a/source/includes/driver-example-update-52.rst +++ b/source/includes/driver-example-update-52.rst @@ -40,3 +40,12 @@ :dedent: 4 :start-after: Start Example 52 :end-before: End Example 52 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 52 + :end-before: End Example 52 diff --git a/source/includes/driver-example-update-53.rst b/source/includes/driver-example-update-53.rst index b5ccdd3e0fc..0e242241c95 100644 --- a/source/includes/driver-example-update-53.rst +++ b/source/includes/driver-example-update-53.rst @@ -32,11 +32,11 @@ :start-after: Start Example 53 :end-before: End Example 53 - - id: perl + - id: ruby content: | .. class:: copyable-code - .. literalinclude:: /driver-examples/driver-examples.t - :language: perl - :dedent: 4 + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 :start-after: Start Example 53 :end-before: End Example 53 diff --git a/source/includes/driver-example-update-54.rst b/source/includes/driver-example-update-54.rst index ccecf873b13..810683cd9ea 100644 --- a/source/includes/driver-example-update-54.rst +++ b/source/includes/driver-example-update-54.rst @@ -37,3 +37,12 @@ :dedent: 4 :start-after: Start Example 54 :end-before: End Example 54 + + - id: ruby + content: | + .. class:: copyable-code + .. literalinclude:: /driver-examples/shell_examples_spec.rb + :language: ruby + :dedent: 8 + :start-after: Start Example 54 + :end-before: End Example 54 diff --git a/source/includes/extracts-filter.yaml b/source/includes/extracts-filter.yaml index 19b6f3f952f..5b4841ea654 100644 --- a/source/includes/extracts-filter.yaml +++ b/source/includes/extracts-filter.yaml @@ -43,6 +43,16 @@ content: | .. code-block:: perl { => , ... } + + - id: ruby + content: | + To specify equality conditions, use `` => `` + expressions in the + :ref:`query filter document `: + + .. code-block:: ruby + + { => , ... } --- ref: filter-equality-embedded content: | @@ -82,6 +92,13 @@ content: | ``{ => }`` where ```` is the document to match. + - id: ruby + content: | + To specify an equality condition on a field that is an + embedded/nested document, use the + :ref:`query filter document ` + ``{ => }`` where ```` is the document + to match. --- ref: filter-equality-array content: | @@ -113,6 +130,11 @@ content: | document ``{ => }`` where ```` is the exact array to match, including the order of the elements. + - id: ruby + content: | + To specify equality condition on an array, use the query + document ``{ => }`` where ```` is the + exact array to match, including the order of the elements. --- ref: filter-equality-array-element content: | @@ -143,6 +165,12 @@ content: | To query if the array field contains at least *one* element with the specified value, use the filter ``{ => }`` where value is the element value. + + - id: ruby + content: | + To query if the array field contains at least *one* element + with the specified value, use the filter + ``{ => }`` where value is the element value. --- ref: filter-query-operators content: | @@ -189,6 +217,16 @@ content: | .. code-block:: perl { => { => }, ... } + + - id: ruby + content: | + A :ref:`query filter document ` can + use the :ref:`query operators ` to specify + conditions in the following form: + + .. code-block:: ruby + + { => { => }, ... } --- ref: filter-query-operators-array content: | @@ -236,4 +274,13 @@ content: | { => { => , ... } } + - id: ruby + content: | + To specify conditions on the elements in the array field, + use :ref:`query operators ` in the + :ref:`query filter document `: + + .. code-block:: ruby + + { => { => , ... } } ... diff --git a/source/tutorial/insert-documents.txt b/source/tutorial/insert-documents.txt index e0153390311..64d87ac6e18 100644 --- a/source/tutorial/insert-documents.txt +++ b/source/tutorial/insert-documents.txt @@ -77,6 +77,18 @@ Insert a Single Document with an ObjectId value to the new document. See :ref:`write-op-insert-behavior`. + - id: ruby + content: | + :ruby-api:`Mongo::Collection#insert_one()` + inserts a *single* :ref:`document` into a + collection. + + The following example inserts a new document into the + ``inventory`` collection. If the document does not specify + an ``_id`` field, the Ruby driver adds the ``_id`` field + with an ObjectId value to the new document. See + :ref:`write-op-insert-behavior`. + .. include:: /includes/driver-example-insert-1.rst .. tabs:: @@ -115,6 +127,15 @@ Insert a Single Document ``inserted_id`` attribute contains the ``_id`` of the newly inserted document. + - id: ruby + content: | + Upon successful insert, the + :ruby-api:`insert_one()` + method returns an instance of + :ruby-api:`Mongo::Operation::Result`, whose + ``inserted_id`` attribute contains the ``_id`` of the newly + inserted document. + To retrieve the document that you just inserted, :ref:`query the collection `: @@ -174,6 +195,17 @@ Insert Multiple Documents ``_id`` field, the Perl driver adds the ``_id`` field with an ObjectId value to each document. See :ref:`write-op-insert-behavior`. + - id: ruby + content: | + :ruby-api:`Mongo::Collection#insert_many()` + can insert *multiple* :ref:`documents ` into a + collection. Pass an array of documents to the method. + + The following example inserts three new documents into the + ``inventory`` collection. If the documents do not specify an + ``_id`` field, the Ruby driver adds the ``_id`` field with + an ObjectId value to each document. See :ref:`write-op-insert-behavior`. + .. include:: /includes/driver-example-insert-3.rst .. tabs:: @@ -212,6 +244,15 @@ Insert Multiple Documents whose ``inserted_ids`` attribute is a list containing the ``_id`` of each newly inserted document. + - id: ruby + content: | + Upon successful insert, the + :ruby-api:`insert_many()` method + returns an instance of + :ruby-api:`Mongo::BulkWrite::Result` + whose ``inserted_ids`` attribute is a list containing the + ``_id`` of each newly inserted document. + To retrieve the inserted documents, :ref:`query the collection `: @@ -290,6 +331,16 @@ requested from MongoDB for write operations. For details, see - :ref:`additional-inserts` + - id: ruby + content: | + .. seealso:: + + - :ruby-api:`Mongo::Collection#insert_one()` + + - :ruby-api:`Mongo::Collection#insert_many()` + + - :ref:`additional-inserts` + .. class:: hidden .. toctree:: diff --git a/source/tutorial/project-fields-from-query-results.txt b/source/tutorial/project-fields-from-query-results.txt index 1a530d932c5..c121849e116 100644 --- a/source/tutorial/project-fields-from-query-results.txt +++ b/source/tutorial/project-fields-from-query-results.txt @@ -51,6 +51,12 @@ Return All Fields in Matching Documents :perl-api:`find()` method returns all fields in the matching documents. + - id: ruby + content: | + If you do not specify a :term:`projection` document, the + :ruby-api:`find()` + method returns all fields in the matching documents. + The following example returns all fields from all documents in the ``inventory`` collection where the ``status`` equals ``"A"``: @@ -198,6 +204,15 @@ to return just the last element in the ``instock`` array. ``{ "instock.0" => 1 }`` projection will *not* project the array with the first element. + - id: ruby + content: | + :projection:`$elemMatch`, :projection:`$slice`, and + :projection:`$` are the *only* way to project specific elements + to include in the returned array. For instance, you *cannot* + project specific array elements using the array index; e.g. + ``{ "instock.0" => 1 }`` projection will *not* project the array + with the first element. + .. seealso:: :doc:`/tutorial/query-documents` .. tabs:: diff --git a/source/tutorial/query-documents.txt b/source/tutorial/query-documents.txt index d0e0c767f97..d6939e7d0c2 100644 --- a/source/tutorial/query-documents.txt +++ b/source/tutorial/query-documents.txt @@ -57,6 +57,11 @@ These operation corresponds to the following SQL statement: For more information on the syntax of the method, see :perl-api:`find()`. + - id: ruby + content: | + For more information on the syntax of the method, see + :ruby-api:`find()`. + .. _read-operations-query-argument: Specify Equality Condition @@ -218,6 +223,17 @@ Cursor documentation for `iterating over a cursor `_. + - id: ruby + content: | + The :ruby-api:`Mongo::Collection#find()` + method returns a :ruby-api:`CollectionView`, + which is an ``Enumerable``. A :ruby-api:`Cursor` is + created when the ``View`` is enumerated; for example, by calling + ``#to_a()`` or ``#each()``. You can also get an ``Enumerator`` by calling + ``#to_enum()`` on the ``View``. See the Ruby driver API documentation + for `iterating over a cursor + `_. + Read Isolation ~~~~~~~~~~~~~~ @@ -313,3 +329,10 @@ The following methods can also read documents from a collection: method is the :perl-api:`MongoDB::Collection::find()` method with a limit of 1. + + - id: ruby + content: | + - In :doc:`aggregation pipeline `, the + :pipeline:`$match` pipeline stage provides access to MongoDB + queries. See the MongoDB Ruby driver's + `aggregation examples `_. diff --git a/source/tutorial/query-for-null-fields.txt b/source/tutorial/query-for-null-fields.txt index f682c265905..d3ae273088d 100644 --- a/source/tutorial/query-for-null-fields.txt +++ b/source/tutorial/query-for-null-fields.txt @@ -29,6 +29,12 @@ Different query operators in MongoDB treat ``null`` values differently. You must use ``undef`` with the MongoDB Perl driver to query for ``null`` or missing fields in MongoDB. + - id: ruby + content: | + .. important:: + You must use ``nil`` with the MongoDB Ruby driver to + query for ``null`` or missing fields in MongoDB. + .. include:: /includes/driver-example-query-38.rst .. _faq-comparison-with-null: @@ -63,6 +69,12 @@ Equality Filter contain the ``item`` field whose value is ``null`` *or* that do not contain the ``item`` field. + - id: ruby + content: | + The ``{ item => nil }`` query matches documents that either + contain the ``item`` field whose value is ``nil`` *or* that + do not contain the ``item`` field. + For example, the following query returns both documents: .. include:: /includes/driver-example-query-39.rst @@ -101,6 +113,13 @@ Type Check i.e. the value of the ``item`` field is of BSON Type ``Null`` (i.e. ``10``) : + - id: ruby + content: | + The ``{ item => { $type => 10 } }`` query matches documents that + contains the ``item`` field whose value is ``nil`` *only*; + i.e. the value of the ``item`` field is of BSON Type ``Null`` + (i.e. ``10``) : + .. include:: /includes/driver-example-query-40.rst The query returns only the document where the ``item`` field has a @@ -132,6 +151,11 @@ Existence Check The ``{ item => { $exists => false } }`` query matches documents that do not contain the ``item`` field: + - id: ruby + content: | + The ``{ item => { $exists => false } }`` query matches documents + that do not contain the ``item`` field: + .. include:: /includes/driver-example-query-41.rst The query returns only the document that does *not* contain the diff --git a/source/tutorial/remove-documents.txt b/source/tutorial/remove-documents.txt index 15ca7969c23..541d23882a1 100644 --- a/source/tutorial/remove-documents.txt +++ b/source/tutorial/remove-documents.txt @@ -50,6 +50,15 @@ Delete Documents - :perl-api:`MongoDB::Collection::delete_many()` - :perl-api:`MongoDB::Collection::delete_one()` + - id: ruby + content: | + This page provides examples of delete operations using the + following methods in the + `MongoDB Ruby Driver `_: + + - :ruby-api:`Mongo::Collection#delete_many()` + - :ruby-api:`Mongo::Collection#delete_one()` + The examples on this page use the ``inventory`` collection. To populate the ``inventory`` collection, run the following: @@ -89,6 +98,13 @@ Delete All Documents :perl-api:`MongoDB::Collection::delete_many()` method. + - id: ruby + content: | + To remove all documents from a collection, pass an empty + :ref:`filter` document ``{}`` to the + :ruby-api:`Mongo::Collection#delete_many()` + method. + The following example deletes *all* documents from the ``inventory`` collection: @@ -136,6 +152,13 @@ syntax as read operations: :perl-api:`delete_many()` method. + - id: ruby + content: | + To delete all documents that match a deletion criteria, pass a + :ref:`filter ` parameter to the + :ruby-api:`delete_many()` + method. + The following example removes all documents from the ``inventory`` collection where the ``status`` field equals ``"A"``: @@ -177,6 +200,13 @@ Remove Only One Document that Matches a Condition filter) use the :perl-api:`MongoDB::Collection::delete_one()` method. + - id: ruby + content: | + To delete at most a single document that matches a specified + filter (even though multiple documents may match the specified + filter) use the + :ruby-api:`Mongo::Collection#delete_one()` method. + The following example deletes the *first* document where ``status`` is ``"D"``. @@ -251,10 +281,19 @@ requested from MongoDB for write operations. For details, see - :ref:`additional-deletes` + - id: ruby + content: | + .. seealso:: + + - :ruby-api:`Mongo::Collection#delete_many()` + + - :ruby-api:`Mongo::Collection#delete_one()` + + - :ref:`additional-deletes` + .. class:: hidden .. toctree:: :titlesonly: /reference/delete-methods - diff --git a/source/tutorial/update-documents.txt b/source/tutorial/update-documents.txt index bd85106366d..58a34d28df4 100644 --- a/source/tutorial/update-documents.txt +++ b/source/tutorial/update-documents.txt @@ -60,6 +60,17 @@ Update Documents - :perl-api:`MongoDB::Collection::replace_one()` + - id: ruby + content: | + This page provides examples of how to update documents using the + following methods in the `MongoDB Ruby Driver `_: + + - :ruby-api:`Mongo::Collection#update_one()` + + - :ruby-api:`Mongo::Collection#update_many()` + + - :ruby-api:`Mongo::Collection#replace_one()` + The examples on this page use the ``inventory`` collection. To create and/or populate the ``inventory`` collection, run the following: @@ -118,6 +129,16 @@ update document of the form: ... } + - id: ruby + content: | + .. code-block:: ruby + + { + => { => , ... }, + => { => , ... }, + ... + } + Some update operators, such as :update:`$set`, will create the field if the field does not exist. See the individual :manual:`update operator ` reference for details. @@ -158,6 +179,13 @@ Update a Single Document ``inventory`` collection to update the *first* document where ``item`` equals ``"paper"``: + - id: ruby + content: | + The following example uses the + :ruby-api:`update_one()` method on the + ``inventory`` collection to update the *first* document where + ``item`` equals ``"paper"``: + .. include:: /includes/driver-example-update-52.rst The update operation: @@ -209,6 +237,13 @@ Update Multiple Documents the ``inventory`` collection to update all documents where ``qty`` is less than ``50``: + - id: ruby + content: | + The following example uses the + :ruby-api:`update_many()` method on + the ``inventory`` collection to update all documents where + ``qty`` is less than ``50``: + .. include:: /includes/driver-example-update-53.rst The update operation: @@ -252,6 +287,12 @@ Replace a Document field, pass an entirely new document as the second argument to :perl-api:`replace_one()`. + - id: ruby + content: | + To replace the entire content of a document except for the ``_id`` + field, pass an entirely new document as the second argument to + :ruby-api:`replace_one()`. + When replacing a document, the replacement document must consist of only field/value pairs; i.e. do not include :manual:`update operators @@ -345,6 +386,16 @@ Field Order it. If there are matching documents, then the operation modifies or replaces the matching document or documents. + - id: ruby + content: | + If :ruby-api:`update_one()`, + :ruby-api:`update_many()`, or + :ruby-api:`replace_one()` includes + ``upsert => true`` **and** no documents match the specified + filter, then the operation creates a new document and inserts + it. If there are matching documents, then the operation + modifies or replaces the matching document or documents. + For details on the new document created, see the individual reference pages for the methods. @@ -408,6 +459,18 @@ requested from MongoDB for write operations. For details, see - :ref:`additional-updates` + - id: ruby + content: | + .. seealso:: + + - :ruby-api:`Mongo::Collection#update_one()` + + - :ruby-api:`Mongo::Collection#update_many()` + + - :ruby-api:`Mongo::Collection#replace_one()` + + - :ref:`additional-updates` + .. class:: hidden .. toctree::