Closed amiceli closed 1 year ago
When I try to insert a doc with an array of tuple :
og = [{"property"=>"og:title","content"=>"Open Graph protocol"},{"property"=>"og:type","content"=>"website"}] bookmarkCollection.insert({ "link" => "https://angular.io", "og" => og, "tags" => [firstTag, secondTag] })
I've following error :
no overload matches 'BSON#[]=' with types String, (BSON | Mongo::Cursor | Nil)
- BSON#[]=(key, value : Int64) - BSON#[]=(key, value : Binary) - BSON#[]=(key, value : Bool) - BSON#[]=(key, value : Float64 | Float32) - BSON#[]=(key, value : MinKey) - BSON#[]=(key, value : MaxKey) - BSON#[]=(key, value : Nil) - BSON#[]=(key, value : ObjectId) - BSON#[]=(key, value : String) - BSON#[]=(key, value : Symbol) - BSON#[]=(key, value : Time) - BSON#[]=(key, value : Timestamp) - BSON#[]=(key, value : Code) - BSON#[]=(key, value : BSON) - BSON#[]=(key, value : Regex) Couldn't find overloads for these types: - BSON#[]=(key : String, value : Mongo::Cursor) bson[i.to_s] = item
@amiceli You need to use .to_bson on your hash array there, hopefully should fix the issue, this implementation makes use of binary JSON, hence the BSON errors.
.to_bson
When I try to insert a doc with an array of tuple :
I've following error :