Skip to content

Commit

Permalink
Merge branch 'master' into uncastable-value
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyshields authored Apr 14, 2024
2 parents 27417a7 + ca3e02e commit 16d05a7
Show file tree
Hide file tree
Showing 39 changed files with 872 additions and 467 deletions.
131 changes: 131 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement through GitHub.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
8 changes: 3 additions & 5 deletions docs/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ Mongoid

.. default-domain:: mongodb

Mongoid is the officially supported object-document mapper (ODM)
for MongoDB in Ruby.
Mongoid is the officially supported object-document mapper (ODM) for MongoDB in
Ruby. To work with Mongoid from the command line using ``rails``-like tooling,
the `railsmdb <https://github.com/mongodb/mongoid-railsmdb>`_ utility can be used.

.. toctree::
:titlesonly:
Expand All @@ -21,6 +22,3 @@ for MongoDB in Ruby.
contributing
additional-resources
ecosystem


For documentation on Mongoid 3 and 4, see `<http://mongoid.github.io>`_.
35 changes: 26 additions & 9 deletions docs/installation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,33 @@ To install the gem with bundler, include the following in your ``Gemfile``:
Using Mongoid with a New Rails Application
==========================================

When creating a new Rails application and wish to use Mongoid for
data access, give the ``--skip-active-record`` flag to the ``rails new``
command to avoid depending on and configuring ActiveRecord..
By using the `railsmdb CLI <https://github.com/mongodb/mongoid-railsmdb>`_ a new
Ruby on Rails application can be quickly generated using the same options as
``rails new``, but configured to work with MongoDB:

.. code-block:: sh

railsmdb new my_new_rails_app

The ``rails`` CLI can also be used, however when creating a new Rails application
and where Mongoid will be used for data access, provide the ``--skip-active-record``
flag to the ``rails new`` command to avoid depending on and configuring ActiveRecord.

Additional examples can be found in the `tutorials <tutorials.html>`_.

Using Mongoid with an Existing Rails Application
================================================

When converting an existing Rails application to use Mongoid for data access,
the ``config/application.rb`` file needs to be updated to remove the
``require 'rails/all'`` line and explicitly include the required frameworks
(which could be all of the frameworks provided by Rails with the exception of
ActiveRecord). Any references to ActiveRecord in files in the ``config``
directory and in the models also need to be removed.
Using the `railsmdb CLI <https://github.com/mongodb/mongoid-railsmdb>`_ an existing
Rails application can easily be configured for use with Mongoid:

.. code-block:: sh

railsmdb setup

Converting an existing Rails application without using ``railsmdb`` can be done
by updating the ``config/application.rb`` file to remove the ``require 'rails/all'``
line and explicitly include the required frameworks (which could be all of the
frameworks provided by Rails with the exception ofActiveRecord).
Any references to ActiveRecord in files in the ``config`` directory and in the
models also need to be removed.
19 changes: 9 additions & 10 deletions docs/reference/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -396,15 +396,15 @@ for details on driver options.
driver_options:
# When this flag is off, an aggregation done on a view will be executed over
# the documents included in that view, instead of all documents in the
# collection. When this flag is on, the view fiter is ignored.
# collection. When this flag is on, the view filter is ignored.
# broken_view_aggregate: true

# When this flag is set to false, the view options will be correctly
# propagated to readable methods.
# broken_view_options: true

# When this flag is set to true, the update and replace methods will
# validate the paramters and raise an error if they are invalid.
# validate the parameters and raise an error if they are invalid.
# validate_update_replace: false


Expand Down Expand Up @@ -541,9 +541,8 @@ Place the following in one of environment configuration files, such as

.. note::

The ``log_level`` Mongoid `configuration option <configuration-options>`_
is not used when Mongoid operates in a Rails application, because Mongoid
inherits Rails' log level in this case.
The ``log_level`` Mongoid configuration option is not used when Mongoid operates
in a Rails application, because Mongoid inherits Rails' log level in this case.

To configure either Mongoid or driver logger differently from the Rails logger,
use an initializer as follows:
Expand Down Expand Up @@ -590,8 +589,8 @@ Standalone
----------

When not loaded in a Ruby on Rails application, Mongoid respects the
``log_level`` top level `configuration option <configuration-options>`_.
It can be given in the configuration file as follows:
``log_level`` top level configuration option. It can be given in the
configuration file as follows:

.. code-block:: yaml

Expand Down Expand Up @@ -746,11 +745,11 @@ It may be desirable to further configure TLS options in your application, for
example by enabling or disabling certain ciphers.

This can be done by setting TLS context hooks on the Ruby driver -- TLS context
hooks are user-provided ``Proc``s that will be invoked before any TLS socket
hooks are user-provided ``Proc``\(s) that will be invoked before any TLS socket
connection in the driver and can be used to modify the underlying
``OpenSSL::SSL::SSLContext`` object used by the socket.

To set TLS context hooks, add ``Proc``s to the ``Mongo.tls_context_hooks``
To set TLS context hooks, add ``Proc``\(s) to the ``Mongo.tls_context_hooks``
array. This can be done in an initializer. The example below adds a hook
that only enables the "AES256-SHA" cipher.

Expand Down Expand Up @@ -830,7 +829,7 @@ Client-Side Encryption
When loading the configuration file, Mongoid permits the file to contain
``BSON::Binary`` instances which are used for specifying ``keyId`` in
the schema map for `client-side encryption
<https://www.mongodb.com/docs/ruby-driver/current/reference/client-side-encryption/>`_,
<https://www.mongodb.com/docs/ruby-driver/current/reference/in-use-encryption/client-side-encryption/>`_,
as the following example shows:

.. code-block:: yaml
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/fields.txt
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ Reading Uncastable Values
`````````````````````````

When documents in the database contain values of different types than their
represenations in Mongoid, if Mongoid cannot coerce them into the correct type,
representations in Mongoid, if Mongoid cannot coerce them into the correct type,
it will replace the value with ``nil``. Consider the following model and document in the
database:

Expand Down Expand Up @@ -1105,7 +1105,7 @@ used for MongoDB serialization and deserialization as follows:
end

The instance method ``mongoize`` takes an instance of your custom type object, and
converts it into a represenation of how it will be stored in the database, i.e. to pass
converts it into a representation of how it will be stored in the database, i.e. to pass
to the MongoDB Ruby driver. In our example above, we want to store our ``Point``
object as an ``Array`` in the form ``[ x, y ]``.

Expand Down Expand Up @@ -1228,7 +1228,7 @@ which extend its behavior at the your time model classes are loaded.

As an example, we will define a ``:max_length`` option which will add a length
validator for the field. First, declare the new field option in an initializer,
specifiying its handler function as a block:
specifying its handler function as a block:

.. code-block:: ruby

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/queries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ examples.
If any of the ``_id`` values are not found in the database, the behavior of
``find`` depends on the value of the ``raise_not_found_error`` configuration
option. If the option is set to ``true``, ``find`` raises
``Mongoid::Errors::DocumentNotFound`` if any of the ``_id``s are not found.
``Mongoid::Errors::DocumentNotFound`` if any of the ``_id``\s are not found.
If the option is set to ``false`` and ``find`` is given a single ``_id`` to
find and there is no matching document, ``find`` returns ``nil``. If the
option is set to ``false`` and ``find`` is given an array of ids to find
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/rails-integration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ other Rails environment specific options by accessing config.mongoid. The
``mongoid:config`` generator will create an initializer in
``config/initializers/mongoid.rb`` which can also be used for configuring
Mongoid. Note, though, that options set in your ``config/mongoid.yml`` will
take precendence over options set elsewhere; it is recommended that whenever
take precedence over options set elsewhere; it is recommended that whenever
possible you use ``mongoid.yml`` as the default location for Mongoid
configuration.

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/sharding.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Shard keys can be declared on models using the ``shard_key`` macro:
end

Note that in order to shard a collection, the collection must have an index
that starts with the shard key. Mongoid provides `index management
<indexes>`_ functionality, which the examples here take
that starts with the shard key. Mongoid provides :ref:`index management
<indexes>` functionality, which the examples here take
advantage of.

Mongoid supports two syntaxes for declaring shard keys. The standard syntax
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/text-search.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ To perform text search with Mongoid, follow these steps:
Defining Text Search Index
--------------------------

Index definition through Mongoid is described in detail on the `indexes
<indexes>`_ page. Text search indexes are described in detail
Index definition through Mongoid is described in detail on the :ref:`indexes
<indexes>` page. Text search indexes are described in detail
under `text indexes <https://mongodb.com/docs/manual/core/index-text/>`_
in the MongoDB manual. Below is an example definition of a Band model with
a text index utilizing the description field:
Expand Down
Loading

0 comments on commit 16d05a7

Please sign in to comment.