Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-5210

Prefer symbol field types over class ones

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Do
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      PR: https://github.com/mongodb/mongoid/pull/5121

      Mongoid already supports defining field :type as a Symbol instead of a Class

      field :first_name, type: :string # works today

      However, currently the docs, etc. recommend to use a Class. Generally speaking, it is much better to to use Symbol than Class, because Class uses autoloading etc.

      I'd like to propose the following:

      1. Deprecate (warn) using field :type as a Class
      2. Remove class usage entirely in Mongoid 8.0.
      3. Add ability to define custom field type Symbols

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            shields@tablecheck.com Johnny Shields
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: