failed with error 10068: “invalid operator: $oid”

后端 未结 2 1860
小蘑菇
小蘑菇 2020-12-20 15:05

just updated to the latest version of mongoid (3.1.0) and sidekiq (2.7.2)
now i\'m getting the error : failed with error 10068: \"invalid operator: $oid\"

相关标签:
2条回答
  • 2020-12-20 15:31

    adding this to my gemfile fixed the issue:

    gem 'multi_json', '1.5.1'
    

    i guess something is wrong with the latest version (1.6.0)

    EDIT: the gem has been updated to new version (1.6.1) that fixed this issue. more here: https://github.com/intridea/multi_json/issues/89

    0 讨论(0)
  • 2020-12-20 15:40

    This is actually happening because BSON::ObjectId is not part of JSON... so when Sidekiq tries to serialize the args to the worker, it pukes. Check out this comment: https://github.com/mperham/sidekiq/issues/951#issuecomment-19497803

    The fix is simply to convert IDs to strings when performing a job like:

    EmailSubscribe.perform_async(user.id.to_s)
    
    0 讨论(0)
提交回复
热议问题