Serialization of BSON:ObjectId

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • 5.1.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Hello,

      at the moment,

      o = SomeClass.new
      id = JSON.dump o.id
      => "

      {\"$oid\":\"53aa928b6176721976000000\"}

      "
      id = JSON.load id
      =>

      {"$oid"=>"53aa928b6176721976000000"}
      SomeClass.find(:id => id) # This fails

      This is the process used by sidekiq to serialize parameters for its tasks btw.

      Is there a way to query for a record by passing the {{{"$oid"=>"53aa928b6176721976000000"}

      }} hash directly?

      That would give the symmetric behavior expected of when pushing an id to sidekiq, you retrieve an id in the worker (instead of a hash).

            Assignee:
            Unassigned
            Reporter:
            Olivier Milla
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: