MongocUtils.jl

Extension for the Mongoc julia library
Author AntonioLoureiro
Popularity
0 Stars
Updated Last
1 Year Ago
Started In
October 2020

MongocUtils.jl

Write to Mongo

using Mongoc,MongocUtils

struct Tvalue
   id::String
end

struct Test
    id::String
    i::Int64
    a::Array{Dict,1}
    vt::Vector
    t::Tvalue
end

t1=Test("aa", 1, [Dict("aa"=>1),Dict("c"=>"tt")],[Tvalue("tt")], Tvalue("tt"))
bs=Mongoc.BSON(t1)
Mongoc.BSON with 5 entries:
  "id" => "aa"
  "i"  => 1
  "a"  => Any[Dict{Any,Any}("aa"=>1), Dict{Any,Any}("c"=>"tt")]
  "vt" => Any[Dict{Any,Any}("id"=>"tt")]
  "t"  => Dict{Any,Any}("id"=>"tt")

Read from Mongo

as_struct(Test,bs)
Test("aa", 1, Dict[Dict("aa" => 1), Dict("c" => "tt")], Tvalue[Tvalue("tt")], Tvalue("tt"))

Used By Packages

No packages found.