I have the following function defined to check whether a record exists in a
Mongodb database (thanks a million for PyCall, which make it easy to use
pymongo
to interact with mongodb in julia).
function doesrecexist(collectn::PyObject, rec::Dict{ASCIIString,Any})
# checks if record exists.
r = collectn[:find_one](rec)
return r
end
If I define
rec = ["p" => 0.3]
julia recognizes it as Dict{ASCIIString, Float64}. Then if I do,
doesrecexist(collectn, rec), I get an error saying *ERROR: `doesrecexist`
has no method matching doesrecexist(::PyObject,
::Dict{ASCIIString,Float64})*
If I remove the type declaration for rec in doesrecexist, things work fine.
I have no other method defined for doesrecexist. Does it make sense to get
this error, given
that I intend to allow any values in the rec Dict by declaring Any? Is
there a workaround where I can declare the type for rec when defining the
function, without having
to define doesrecexist for Float values, Int values, String values etc.
Thank you.