{"record":{"id":"ba95002714c2806f","repo":"mongodb/mongoid","slug":"mongoid-no-longer-supports-marshalling-with-driver","errorCode":null,"errorMessage":"Mongoid no longer supports marshalling with driver version 1.x.","messagePattern":"Mongoid no longer supports marshalling with driver version 1\\.x\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"lib/mongoid/criteria/marshalable.rb","lineNumber":33,"sourceCode":"      #\n      # @return [ Array<Object> ] The dumped data.\n      def marshal_dump\n        data = [ klass, :mongo, inclusions, documents, strategy, negating, use_lookup? ]\n        data.push(scoping_options).push(dump_hash(:selector)).push(dump_hash(:options))\n      end\n\n      # Resets the criteria object after a Marshal.load\n      #\n      # @example Load the criteria.\n      #   Marshal.load(criteria)\n      #\n      # @param [ Array ] data The raw data.\n      def marshal_load(data)\n        @scoping_options, raw_selector, raw_options = data.pop(3)\n        @klass, driver, @inclusions, @documents, @strategy, @negating, @use_lookup = data\n\n        if driver == :mongo1x\n          raise NotImplementedError, 'Mongoid no longer supports marshalling with driver version 1.x.'\n        end\n\n        @selector = load_hash(Queryable::Selector, raw_selector)\n        @options = load_hash(Queryable::Options, raw_options)\n      end\n\n      private\n\n      def dump_hash(name)\n        send(name).each_with_object({}) do |(key, value), raw|\n          raw[key] = value\n        end\n      end\n\n      def load_hash(hash_class, raw)\n        hash = hash_class.new(klass.aliased_fields, klass.fields)\n        hash.merge!(raw)\n        hash","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/criteria/marshalable.rb#L15-L51","documentation":"Raised by Criteria#marshal_load when unmarshalling criteria data that was dumped for the MongoDB driver 1.x series. The serialized format changed between driver major versions, so restoring criteria dumped under the old driver is unsupported; the faulting input is the incompatible driver version encoded in the marshalled payload.","triggerScenarios":"Thrown at lib/mongoid/criteria/marshalable.rb:33 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-create the criteria instead of loading stale Marshal payloads","Re-marshal data with a driver 2.x based Mongoid version"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0da0e23d71adfbad31128c18e5e2c8c301c6f7c4","analyzedAt":"2026-08-23T06:25:47.656Z","contentChangedAt":"2026-08-23T06:25:47.656Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}