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

Issue with using time series collections with Mongoid 9

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 9.0.2
    • Affects Version/s: 9.0.0
    • Component/s: None
    • Ruby Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      When using a time series collections we use the following `store_in` option.

       

      class MyModel 
        include Mongoid::Document  
        include Mongoid::ShortTimestamps
        
        field :aid, as: :account_id  belongs_to :account, foreign_key: :aid, inverse_of: :usage_records
        field :c, as: :count, type: Integer  field :m, as: :metadata, type: Hash
        
        store_in collection_options: {    
          time_series: {      
            timeField: 'ca',     
            metaField: 'm',      
            granularity: 'hours'    
        }  }
      end
       

      After upgrading to Mongoid 9 we get the following error.

       

      Mongoid::Errors::InvalidPersistenceOption · Translation missing: en.mongoid.errors.messages.message_title: Translation missing: en.mongoid.errors.messages.invalid_persistence_option.message Translation missing: en.mongoid.errors.messages.summary_title: Translation missing: en.mongoid.errors.messages.invalid_persistence_option.summary Translation missing: en.mongoid.errors.messages.resolution_title: Translation missing: en.mongoid.errors.messages.invalid_persistence_option.resolution              

      If we enable the following, the error goes away.

      Mongoid.legacy_persistence_context_behavior = true

            Assignee:
            dmitry.rybakov@mongodb.com Dmitry Rybakov
            Reporter:
            jarrett@cacheventures.com Jarrett Lusso
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: