ScottPJones / Mongo.jl

Mongo bindings for the Julia programming language
Other
43 stars 21 forks source link

Insert fails in Julia v0.4 #7

Closed szalmaf closed 9 years ago

szalmaf commented 9 years ago

I am doing the following in Julia v0.4:

Pkg.add("Mongo") using Mongo, LibBSON client = MongoClient("mongodb://192.168.99.100:27017/") collection = MongoCollection(client, "meteor", "widgets") oid = insert(collection, {"name"=>"time series"})

where the last line, the insert method, gives a LoadError:

WARNING: deprecated syntax "{a=>b, ...}" at In[36]:1. Use "Dict{Any,Any}(a=>b, ...)" instead. LoadError: MethodError: convert has no method matching convert(::Type{Ptr{Void}}, ::Array{UInt8,1}) This may have arisen from a call to the constructor Ptr{Void}(...), since type constructors fall back to convert methods. Closest candidates are: call{T}(::Type{T}, ::Any) convert{T}(::Type{Ptr{T}}, !Matched::UInt64) convert{T}(::Type{Ptr{T}}, !Matched::Int64) ... while loading In[36], in expression starting on line 1

in insert at /Users/szalmaf/.julia/v0.4/Mongo/src/MongoCollection.jl:42

Do you have any suggestion as to how to resolve this error. It seems like the Mongo package was updated so that it can handle Julia v0.4, I am not sure why I am getting this error message.

ghost commented 9 years ago

What happens if you use the 0.4 syntax instead?

oid = insert(collection, Dict{Any,Any}("name"=>"time series"))
szalmaf commented 9 years ago

Running Pkg.checkout("Mongo") and Pkg.build("Mongo"), and doing the same for LibBSON solved the problem and insert now works in v0.4.

szalmaf commented 9 years ago

Thanks, @pzion, for checking in. My original syntax works when I do the checkout and build as described above. So there is no problem with the Mongo code - except that it does not come with the v0.4 bundle automatically.

ghost commented 9 years ago

OK thanks for letting me know, I've updated the REQUIRES to point to the latest version of LibBSON.

ghost commented 9 years ago

I believe this is now fixed, please reopen if not!