Skip to content

Commit 3d79b38

Browse files
Merge branch 'master' into uncastable-value
2 parents 8394a97 + 082f5d9 commit 3d79b38

File tree

227 files changed

+9380
-2045
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+9380
-2045
lines changed

.evergreen/config.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -763,15 +763,16 @@ buildvariants:
763763
tasks:
764764
- name: "test"
765765

766-
- matrix_name: app-tests-jruby
767-
matrix_spec:
768-
jruby: ["jruby-9.3"]
769-
driver: ["current"]
770-
mongodb-version: '5.0'
771-
topology: standalone
772-
app-tests: yes
773-
rails: ['6.0']
774-
os: ubuntu-18.04
775-
display_name: "app tests ${driver}, ${jruby}"
776-
tasks:
777-
- name: "test"
766+
# https://jira.mongodb.org/browse/MONGOID-5549
767+
# - matrix_name: app-tests-jruby
768+
# matrix_spec:
769+
# jruby: ["jruby-9.3"]
770+
# driver: ["current"]
771+
# mongodb-version: '5.0'
772+
# topology: standalone
773+
# app-tests: yes
774+
# rails: ['6.0']
775+
# os: ubuntu-18.04
776+
# display_name: "app tests ${driver}, ${jruby}"
777+
# tasks:
778+
# - name: "test"

.evergreen/run-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fi
2626

2727
prepare_server $arch
2828

29-
install_mlaunch_virtualenv
29+
install_mlaunch_venv
3030

3131
# Launching mongod under $MONGO_ORCHESTRATION_HOME
3232
# makes its log available through log collecting machinery
@@ -105,7 +105,7 @@ elif test -n "$APP_TESTS"; then
105105
if test -z "$DOCKER_PRELOAD"; then
106106
./spec/shared/bin/install-node
107107
fi
108-
108+
109109
bundle exec rspec spec/integration/app_spec.rb
110110
else
111111
bundle exec rake ci

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ For instructions on upgrading to newer versions, visit
6363

6464
* Mongoid now uses the official Mongo Ruby Driver 2.x instead of Moped.
6565

66-
* Most driver specific configuration options have changed, please see [here](http://docs.mongodb.org/ecosystem/tutorial/ruby-driver-tutorial/#ruby-options) for the new options.
66+
* Most driver specific configuration options have changed, please see [here](https://www.mongodb.com/docs/ecosystem/tutorial/ruby-driver-tutorial/#ruby-options) for the new options.
6767

6868
* All references to `session` are now replaced with `client`. This includes the mongoid.yml configuration, `store_in` options, and all exceptions and modules with `Session` in the name.
6969

@@ -872,8 +872,8 @@ child elements.
872872
handling of validations. (Gerad Suyderhoud)
873873

874874
* \#2443 `expire_after_seconds` is now a valid index option
875-
(http://docs.mongodb.org/manual/core/indexes/#ttl-indexes,
876-
http://docs.mongodb.org/manual/tutorial/expire-data/).
875+
(https://www.mongodb.com/docs/manual/core/indexes/#ttl-indexes,
876+
https://www.mongodb.com/docs/manual/tutorial/expire-data/).
877877

878878
class Event
879879
include Mongoid::Document

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
Copyright (c) 2015-Present MongoDB Inc.
12
Copyright (c) 2009-2016 Durran Jordan
2-
Copyright (c) 2015-2020 MongoDB, Inc.
33

44
Permission is hereby granted, free of charge, to any person obtaining
55
a copy of this software and associated documentation files (the

README.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Mongoid is an ODM (Object-Document Mapper) framework for MongoDB in Ruby.
88
Documentation
99
-------------
1010

11-
Mongoid has [extensive user documentation](https://docs.mongodb.com/mongoid/current/).
12-
[API documentation](https://docs.mongodb.com/mongoid/current/api/) is also available.
11+
Mongoid has [extensive user documentation](https://www.mongodb.com/docs/mongoid/current/).
12+
[API documentation](https://www.mongodb.com/docs/mongoid/current/api/) is also available.
1313

1414
Mongoid is built on top of the MongoDB Ruby driver which has
15-
[its own user documentation](https://docs.mongodb.com/ruby-driver/current/).
15+
[its own user documentation](https://www.mongodb.com/docs/ruby-driver/current/).
1616

1717
Compatibility
1818
-------------
@@ -39,8 +39,8 @@ Support
3939
License
4040
-------
4141

42+
Copyright (c) 2015-Present MongoDB Inc.
4243
Copyright (c) 2009-2016 Durran Jordan
43-
Copyright (c) 2015-2020 MongoDB, Inc.
4444

4545
Permission is hereby granted, free of charge, to any person obtaining
4646
a copy of this software and associated documentation files (the
@@ -61,11 +61,6 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
6161
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
6262
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6363

64-
Credits
65-
-------
66-
67-
Durran Jordan: durran at gmail dot com
68-
6964
[rubygems-img]: https://badge.fury.io/rb/mongoid.svg
7065
[rubygems-url]: http://badge.fury.io/rb/mongoid
7166
[inch-img]: http://inch-ci.org/github/mongodb/mongoid.svg?branch=master

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ currently being supported with security updates.
1515

1616
## Reporting a Vulnerability
1717

18-
Please [follow the instructions here](https://docs.mongodb.com/manual/tutorial/create-a-vulnerability-report/)
18+
Please [follow the instructions here](https://www.mongodb.com/docs/manual/tutorial/create-a-vulnerability-report/)
1919
to report a vulnerability.

docs/contributing.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ Contributing
1010
:titlesonly:
1111

1212
contributing/code-documentation
13+
contributing/contributing-guidelines

docs/contributing/code-documentation.txt

Lines changed: 80 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Structure
3535
class CardboardBox
3636

3737
- **Methods:** All method definitions should be preceded by a documentation comment.
38-
Use ``@param`` and ``@return`` to specify input(s) and output respectively.
38+
Use ``@param``, ``@yield``, and ``@return`` to specify inputs and output.
3939
For further details, refer to
4040
:ref:`Type Declaration <code-documentation-type-declaration>` below.
4141

@@ -48,33 +48,30 @@ Structure
4848
# @return [ Tiger ] The transmogrified result.
4949
def transmogrify(person)
5050

51+
- **Errors:** Use ``@raise`` to explain errors specific to the method.
52+
53+
.. code-block:: ruby
54+
55+
# @raise [ Errors::Validations ] If validation failed.
56+
def validate!
57+
5158
- **Private Methods:** Private methods should be documented unless they are
5259
so brief and straightforward that it is obvious what they do. Note that,
5360
for example, a method may be brief and straightforward but the type of
54-
its parameter may not be obvious, in which case the parameter needs to
55-
be appropriately documented.
61+
its parameter may not be obvious, in which case the parameter must be
62+
appropriately documented.
5663

5764
.. code-block:: ruby
5865

5966
private
6067

6168
# Documentation is optional here.
62-
def my_internal_method
63-
64-
- **Notes:** Use the ``@note`` macro to explain caveats, edge cases,
65-
and behavior which may surprise users.
66-
67-
.. code-block:: ruby
68-
69-
# Clear all stored data.
70-
#
71-
# @note This operation deletes data in the database.
72-
def erase_data!
69+
def do_something_obvious
7370

7471
- **API Private:** Classes and public methods which are not intended for
7572
external usage should be marked ``@api private``. This macro does not
7673
require a comment.
77-
74+
7875
Note that, because Mongoid's modules are mixed into application classes,
7976
``private`` visibility of a method does not necessarily indicate its
8077
status as an API private method.
@@ -86,6 +83,18 @@ Structure
8683
# @api private
8784
def dont_call_me_from_outside
8885

86+
- **Notes and TODOs:** Use ``@note`` to explain caveats, edge cases,
87+
and behavior which may surprise users. Use ``@todo`` to record
88+
follow-ups and suggestions for future improvement.
89+
90+
.. code-block:: ruby
91+
92+
# Clear all stored data.
93+
#
94+
# @note This operation deletes data in the database.
95+
# @todo Refactor this method for performance.
96+
def erase_data!
97+
8998
- **Deprecation:** Use the ``@deprecated`` macro to indicate deprecated
9099
functionality. This macro does not require a comment.
91100

@@ -286,3 +295,59 @@ Type Declaration
286295
# @option **kwargs [ String | Array<String> ] :items The items(s) as Strings to include.
287296
# @option **kwargs [ Integer ] :limit An Integer denoting the limit.
288297
def buy_groceries(**kwargs)
298+
299+
- **Blocks:** Use ``@yield`` to specify when the method yields to a block.
300+
301+
.. code-block:: ruby
302+
303+
# @yield [ Symbol, Symbol, Symbol ] Evaluate the guess of who did the crime.
304+
# Must take the person, location, and weapon used. Must return true or false.
305+
def whodunit
306+
yield(:mustard, :ballroom, :candlestick)
307+
end
308+
309+
- **Blocks:** If the method explicitly specifies a block argument, specify the block
310+
argument using ``@param`` preceded by an ampersand ``&``, and also specify ``@yield``.
311+
Note ``@yield`` should be used even when method calls ``block.call`` rather than
312+
``yield`` internally.
313+
314+
.. code-block:: ruby
315+
316+
# @param &block The block.
317+
# @yield [ Symbol, Symbol, Symbol ] Evaluate the guess of who did the crime.
318+
# Must take the person, location, and weapon used. Must return true or false.
319+
def whodunit(&block)
320+
yield(:scarlet, :library, :rope)
321+
end
322+
323+
# @param &block The block.
324+
# @yield [ Symbol, Symbol, Symbol ] Evaluate the guess of who did the crime.
325+
# Must take the person, location, and weapon used. Must return true or false.
326+
def whodunit(&block)
327+
block.call(:plum, :kitchen, :pipe)
328+
end
329+
330+
- **Blocks:** Use ``@yieldparam`` and ``@yieldreturn`` instead of ``@yield`` where
331+
beneficial for clarity.
332+
333+
.. code-block:: ruby
334+
335+
# @param &block The block.
336+
# @yieldparam [ Symbol ] The person.
337+
# @yieldparam [ Symbol ] The location.
338+
# @yieldparam [ Symbol ] The weapon used.
339+
# @yieldreturn [ true | false ] Whether the guess is correct.
340+
def whodunit(&block)
341+
yield(:peacock, :conservatory, :wrench)
342+
end
343+
344+
- **Proc Args:** Proc arguments should use ``@param`` (not ``@yield``). The
345+
inputs to the proc may be specified as subtype(s).
346+
347+
.. code-block:: ruby
348+
349+
# @param [ Proc<Integer, Integer, Integer> ] my_proc Proc argument which must
350+
# take 3 integers and must return true or false whether the guess is valid.
351+
def guess_three(my_proc)
352+
my_proc.call(42, 7, 88)
353+
end
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.. _contributing-guildelines:
2+
3+
***********************
4+
Contributing Guidelines
5+
***********************
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
15+
16+
Contributing Guidelines
17+
=======================
18+
19+
If you wish to propose an enhancement to Mongoid, please create a Jira ticket
20+
describing the enhancement and what it would enable you to achieve in your
21+
application that is not already possible. If you believe Mongoid is not
22+
behaving correctly, please create a Jira ticket describing how you use Mongoid,
23+
what the existing behavior is that you consider incorrect or problematic, and
24+
what your desired behavior is. If you wish to make changes yourself, the
25+
following guildelines should be followed:
26+
27+
#. Create a fork of Mongoid.
28+
#. Create a new branch in that fork.
29+
#. Make your changes.
30+
#. Ensure that the proposed changes have adequate test coverage.
31+
#. Raise a PR against Mongoid master. If these changes correspond to a specific
32+
Jira ticket, title the PR: "MONGOID-<ticket #> Description of Changes".
33+
#. The Mongoid team will review the PR and make comments/suggest changes.
34+
#. Once all of the changes and fixes are made, and the Mongoid team determine
35+
the PR fit for merging, we will merge the PR into master and determine
36+
whether it needs to be backported.
37+
#. Backports to previous stable versions are done if the change is a bug fix,
38+
is not backwards breaking, and if the commit is applicable to the
39+
corresponding stable branch. Presently backport candidates would include
40+
versions 7.3-8.0.
41+
#. Changes to 6.0-7.2 are generally not made unless it fixes a security
42+
vulnerability.
43+
#. 5.x and earlier is generally not supported.

docs/installation.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ To install the gem with bundler, include the following in your ``Gemfile``:
2727

2828
.. code-block:: ruby
2929

30-
gem 'mongoid', '~> 7.3.0'
30+
gem 'mongoid', '~> 9.0.0'
3131

3232
Using Mongoid with a New Rails Application
3333
==========================================

0 commit comments

Comments
 (0)