<commit_before># Overview

For instructions on upgrading to newer versions, visit
[mongoid.org](http://mongoid.org/docs/upgrading.html).

## 3.1.0 (branch: master)

### New Features

* \#2257 `after_find` callbacks have been added for when documents are returned
  from the database.

        class Band
          include Mongoid::Document

          after_find do |doc|
            # Some logic here.
          end
        end

* \#2223 Allow to find documents by javascript with parameters that are
  protected from javascript injection via `Model.for_js`.

        Band.for_js("this.name = param", param: "Tool")
        Band.where(:likes.gt => 1000).for_js("this.likes < this.follows")

* \#2197 When providing session configuration with no ports, Mongoid will now
  default these to 27017.

* \#2180 1-n and n-n relations now support before/after add/remove callbacks.
  (<NAME>)

        class Band
          include Mongoid::Document

          embeds_many :albums, after_add: :notify_labels
          has_many :followers, before_remove: ->(band, follower){ notify_unfollow(follower) }
        end

* \#1766 Many to many relations will not touch the database if the foreign key
  is an empty array.

### Resolved Issues

## 3.0.4 (branch: 3.0.0-stable)

### Resolved Issues

* \#2272 Don't wipe selectors or options when removing the default scope for
  actual nil values. Must check if key exists as well.

* \#2266 Restored paranoid documents are no longer flagged as destroyed.
  (<NAME>)

* \#2263 Ensure casting of non object id foreign keys on many to many relations
  happens in the initial set, not at validation time.

## 3.0.3

### Resolved Issues

* \#2259 Ensure subclassed documents can not be pulled from the identity map
  via an id of another document in the same collection with a parent or
  sibeling type.

* \#2254 $inc operations no longer convert all values to floats.

* \#2252 Don't fire autosave when before callbacks have terminated.

* \#2248 Improved the performance of `exists?` on criteria and relations.
  (<NAME>)

## 3.0.2

### Resolved Issues

* \#2244 Get rid of id mass assignment warnings in nested attributes.
<commit_msg>Update changelog<commit_after># Overview

For instructions on upgrading to newer versions, visit
[mongoid.org](http://mongoid.org/docs/upgrading.html).

## 3.1.0 (branch: master)

### New Features

* \#2257 `after_find` callbacks have been added for when documents are returned
  from the database.

        class Band
          include Mongoid::Document

          after_find do |doc|
            # Some logic here.
          end
        end

* \#2223 Allow to find documents by javascript with parameters that are
  protected from javascript injection via `Model.for_js`.

        Band.for_js("this.name = param", param: "Tool")
        Band.where(:likes.gt => 1000).for_js("this.likes < this.follows")

* \#2197 When providing session configuration with no ports, Mongoid will now
  default these to 27017.

* \#2180 1-n and n-n relations now support before/after add/remove callbacks.
  (<NAME>)

        class Band
          include Mongoid::Document

          embeds_many :albums, after_add: :notify_labels
          has_many :followers, before_remove: ->(band, follower){ notify_unfollow(follower) }
        end

* \#1766 Many to many relations will not touch the database if the foreign key
  is an empty array.

### Resolved Issues

## 3.0.4 (branch: 3.0.0-stable)

### Resolved Issues

* \#2274 When loading models, warn if error is raised but continue processing.

* \#2272 Don't wipe selectors or options when removing the default scope for
  actual nil values. Must check if key exists as well.

* \#2266 Restored paranoid documents are no longer flagged as destroyed.
  (<NAME>)

* \#2263 Ensure casting of non object id foreign keys on many to many relations
  happens in the initial set, not at validation time.

## 3.0.3

### Resolved Issues

* \#2259 Ensure subclassed documents can not be pulled from the identity map
  via an id of another document in the same collection with a parent or
  sibeling type.

* \#2254 $inc operations no longer convert all values to floats.

* \#2252 Don't fire autosave when before callbacks have terminated.

* \#2248 Improved the performance of `exists?` on criteria and relations.
  (<NAME>)

## 3.0.2

### Resolved Issues

* \#2244 Get rid of id mass assignment warnings in nested attributes.

{'fraction_non_alphanumeric': 0.08716323296354993, 'fraction_numerical': 0.0357708852162101, 'mean_word_length': 3.175803402646503, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3974849', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1240, 'n_words': 539}