Skip to content

Mongoid data duplicated #577

@KinWang-2013

Description

@KinWang-2013

record(param)&.update!(params(param)) || RecordClass.create!(params(param))

def record(param)
	RecordClass.find_by(
		field1: 'a',
        field2: 'b',
        field3: 'c',
        field4: [param]
  	)
end

I have a background job to create or update a record, as I have given in the example above, the code is something like that but the thing is when the data is always created even if the data exists in the database.

NOTE: for first few jobs, it updates but suddenly the data starts to get created

but once I change the job to perform now, the data is updated

I use mongoid, solid queue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions