-
-
Save digitalextremist/98406f67aec7eb80226c6f9c27edfbed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In lib/mongo/src/bson.cr:228:61 | |
228 | unless LibBSON.bson_append_array_begin(handle, key, key.bytesize, child_handle) | |
^------- | |
Error: undefined method 'bytesize' for Array(MessagePack::Type) (compile-time type is (Array(MessagePack::Type) | Bool | Float64 | Hash(MessagePack::Type, MessagePack::Type) | Int16 | Int32 | Int64 | Int8 | String | UInt16 | UInt32 | UInt64 | UInt8 | Nil)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "msgpack" | |
require "mongo/bson" | |
query = { | |
"age" => { | |
"$gt" => 30 | |
} | |
} | |
#de Native Hash to MessagePack encoded string... | |
puts msgpack = String.new(query.to_msgpack) | |
#de Encided string to Hash(String, MessagePack::Type) | |
query_reborn = Hash(String, MessagePack::Type).from_msgpack(msgpack) | |
#de The goal: | |
puts bson = query.to_bson #de Works | |
puts bson = query_reborn.to_bson #de Throws type-oriented error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment