Hi Kevin,
I'm sorry to hear (and see) that you haven't gotten much help on the Julia
mailing list. It's probably just that your request hasn't fallen on the
ears of anyone who has interest in both Mongo and Julia and the time to
help. I'm almost in that category, in that I have a small interest in
Mongo (and a lot of interest in Julia), but only so much time.
I will say that once you get something working, the mailing list will
usually be a good resource, but it works best if you have specific
questions or problems (e.g., I'm trying to do this with the following code,
but it's not working--what am I doing wrong) vs. general requests (e.g.,
asking for help wrapping mongo with a mostly empty repo).
I'm assuming this is your first major Julia project? If so, my first
suggestion is to ignore everything written below (for now), and try to get
the Mongo.jl library running on a modern Julia first, and make sure you
understand everything that it's doing. Only after that would I try
anything below.
----
In truth, I don't know the best way forward, but I can give you a little
more information, and maybe it will help you decide.
Clang.jl is a general framework for wrapping C libraries. It's never
necessary--any C library can be called directly using ccall. But ccalls
can be kind of clunky, so Clang.jl provides an API which very closely
mimics the C API provided in some header file: functions have very similar
signatures, and structs become julia types. For a large library with lots
of functions, or complicated structs with lots of members, this can make
wrapping relatively easy.
While the output of Clang.jl is usually reasonably nice, it's still a very
low level of abstraction. Actually, very little abstraction, because it
matches the C library, which is usually very low level, and still somewhat
inconvenient in Julia (but more convenient than ccalls). To be useful,
you'll often want to add a higher level API on top of that, which adds
functions and/or types that encompass or simplify the lower level calls.
It's also often the case that Clang.jl doesn't give you exactly what you
need--e.g., it doesn't know how to wrap certain things, such as unions and
C macros. In those cases, you'll have to edit the output by hand, or spend
some time programmatically filtering/modifying the results. I do this a
bit in the wrapper for VideoIO
<https://github.com/kmsquire/VideoIO.jl/blob/master/util/wrap_libav_split.jl>
(and
I still have to edit some files by hand at the end).
The main alternative is to wrap a subset of useful functions by hand (or
simply use ccall directly, which amounts to pretty much the same thing).
This is probably closer to what the Mongo folks had in mind when they
directed you to the Lua driver. If you only need access to a few
functions, or if your code is highly specialized in a way that Clang.jl has
trouble with, wrapping by hand can be the way to go. For this, you're
basically writing Julia functions which ccall out to external library
functions (such as those in mongo), and returns the result (or some
modification thereof that matches what would normally be done in Julia).
Hopefully this was useful. Please feel free to post back here with
questions, and I (and maybe others, if the question is right) will try to
answer as we have time.
Cheers!
Kevin
Post by Kevin LiuThanks for the valuable advice and modesty, there is no code in the reps.
I'm learning how to do this properly. From the Mongo side I have received a
little bit of guidance but from the Julia side, very little. Changed it to
CMongo.jl. Clang.jl will be of great help (I had bookmarked it, but didn't
realize it was a wrapper).
Post by Kevin SquireI would suggest CMongo.jl (when renaming this, be careful if you're on a
case-insensitive filesystem). Of the fully capitalized names in Julia,
most of them imply that they are acronyms.
Suggestion: at this point, there isn't much code in the repo. Since not
many people have (publicly) responded to your posts, IMHO, it would be good
to try to get a basic working system in place, and post your progress when
something basic is working--this will make it easier for people to
contribute.
One more thing you should look at is Clang.jl, which makes wrapping C
libraries easier.
Cheers!
Kevin
Post by Kevin LiuI'll name it CMONGO.jl
Post by Kevin LiuAny suggestions for the name? I just want to remember this will be a
wrapper around C Mongo.
Post by Kevin LiuHey Kevin,
That's great. Thanks for the advice. On it right now.
Cheers!
Post by Kevin SquireHi Kevin,
If you plan to make this a Julia package (and I encourage you to do
so), it would be good to look at the Julia package naming conventions
<http://julia.readthedocs.org/en/latest/manual/packages/#guidelines-for-naming-a-package>.
You might consider choosing a different name, generating a package
skeleton, and moving the files in this repo there. Alternatively, renaming
that repo shouldn't be hard.
(This isn't mentioned explicitly there, but dashes also won't work
for Julia package names.)
Cheers!
Kevin
Post by Kevin LiuHi Julia Users, feel free to contribute to the Julia wrapper of the
C Mongo Driver, maintained by Mongo
https://github.com/tenthdimension/Julia-C-Mongo
This Julia wrapper is based on the Lua wrapper of the C Mongo
Driver. Jesse Davis from MongoDB recommended I used it as a reference.
Post by Kevin LiuThanks
On Thursday, July 23, 2015 at 8:24:12 PM UTC-3,
Post by t***@multiscalehn.comhttps://github.com/pzion/LibBSON.jl/pull/4
https://github.com/pzion/Mongo.jl/pull/6
I'm sorry Tim, check this out
https://github.com/10gen-labs/mongorover/issues/16
Could you share how you made it work properly?
Post by Kevin LiuHi Tim, did it pass specs 1, 2, and part of 3? 4 hasn't been
started yet.
These new MongoDB drivers conform to published specifications.
1. Server Selection - Deciding which server to send database
operations to in a MongoDB deployment.
2. Server Discovery and Monitoring - All the logic required to
make a MongoDB application highly available.
3. CRUD API - The API for how we Create, Read, Update and Delete
data from MongoDB.
4. Authentication - The rules for how to authenticate to MongoDB
servers.
https://www.mongodb.com/blog/post/announcing-next-generation-drivers-mongodb
On Wednesday, July 22, 2015 at 4:30:00 PM UTC-3,
Post by t***@multiscalehn.comI have just made pull requests to pzion/LibBSON.jl and
pzion/Mongo.jl to fix the driver in v0.4. Works fine for me, after adding
@compats
Post by Kevin LiuHi,
I have Julia 0.3, Mongodb-osx-x86_64-3.0.4,
and Mongo-c-driver-1.1.9 installed, but can't get Julia to access the Mongo
Client through this 'untestable' package
https://github.com/pzion/Mongo.jl, according to
http://pkg.julialang.org/.
I have tried Lytol/Mongo.jl and the command
require("Mongo.jl") can't open file Mongo.jl, or the auto-generated
deps.jl.
Is anyone having similar problems trying to make Julia work
with Mongo?
Thank you
Kevin