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

field :vid, :type=>Integer allows String to be saved and is valid

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.0
    • Affects Version/s: None
    • Component/s: None

        class VProduct
        include Mongoid::Document
        include Mongoid::Timestamps
        include Tire::Model::Search
        include Tire::Model::Callbacks
      
        field :vid, :type=>Integer   
        field :name                   # name -        Bezeichnung
      
        index :vid, unique: true
      

      when I set vid to a String, the doc is valid and i can save it. (and the string gets saved instead of an integer)

      shouldnt vid only accept Integers in this case?

      In my case i use the gem tire for elasticsearch. and it won't index documents which don't have an integer set for vid.

            Assignee:
            Unassigned Unassigned
            Reporter:
            rand99 randy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: