-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MONGOID-5418 AR Feature Parity first!/last!/second etc. (#5396)
* MONGOID-5418 add test for first-fifth(!) * MONGOID-5418 add rest of the methods + findable tests * MONGOID-5418 add memory methods * MONGOID-5418 add none methods * MONGOID-5418 add documentation * MONGOID-5418 add release notes * MONGOID-5418 fix query docs * MONGOID-5418 fix query cache tests
- Loading branch information
1 parent
f273acd
commit 7a555df
Showing
10 changed files
with
2,229 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
*********** | ||
Mongoid 8.1 | ||
*********** | ||
|
||
.. default-domain:: mongodb | ||
|
||
.. contents:: On this page | ||
:local: | ||
:backlinks: none | ||
:depth: 2 | ||
:class: singlecol | ||
|
||
This page describes significant changes and improvements in Mongoid 8.1. | ||
The complete list of releases is available `on GitHub | ||
<https://github.com/mongodb/mongoid/releases>`_ and `in JIRA | ||
<https://jira.mongodb.org/projects/MONGOID?selectedItem=com.atlassian.jira.jira-projects-plugin:release-page>`_; | ||
please consult GitHub releases for detailed release notes and JIRA for | ||
the complete list of issues fixed in each release, including bug fixes. | ||
|
||
|
||
Added ``Mongoid::Criteria`` finder methods | ||
------------------------------------------ | ||
|
||
Mongoid 8.1 implements several finder methods on ``Mongoid::Criteria``: | ||
|
||
- ``first!`` | ||
- ``last!`` | ||
- ``second/second!`` | ||
- ``third/third!`` | ||
- ``fourth/fourth!`` | ||
- ``fifth/fifth!`` | ||
- ``second_to_last/second_to_last!`` | ||
- ``third_to_last/third_to_last!`` | ||
|
||
When no documents are found, methods without a bang (!) return nil, and methods | ||
with a bang (!) raise an error: | ||
|
||
.. code:: ruby | ||
|
||
Band.none.first | ||
# => nil | ||
|
||
Band.none.first! | ||
# => raise Mongoid::Errors::DocumentNotFound |
Oops, something went wrong.