The custom field option example in https://www.mongodb.com/docs/mongoid/master/reference/fields/#custom-field-options defines an option called :required. This option already exists in Mongoid.
The documentation should either state that this option is already implemented by Mongoid so that users don't try to copy the code as is into their applications, or come up with a different example.