ScottPJones / Mongo.jl

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

command_simple not working #18

Closed paulstey closed 8 years ago

paulstey commented 8 years ago

The command_simple() function doesn't seem to be working.

In fact, I'm trying to duplicate the examples provided in the README.md, and the command_simple() function doesn't even seem to be available. I'm getting an error that suggests it is not defined. Am I missing something?

I'm using Julia 0.4.5, and I just ran Pkg.checkout("Mongo") and Pkg.build("Mongo").

ghost commented 8 years ago

@ivirshup any idea what might be going on here? I think you implemented the command_simple stuff..

ivirshup commented 8 years ago

@paulstey could you paste the results of `

Pkg.status("Mongo")`

and

cd(Pkg.dir()) do 
    Pkg.Read.url("Mongo")
end

?

paulstey commented 8 years ago

Thanks for the quick response. Running

Pkg.status("Mongo")

gives us - Mongo 0.2.0+ master

And then

cd(Pkg.dir()) do 
    Pkg.Read.url("Mongo")
end

gives us "git://github.com/pzion/Mongo.jl.git"

ivirshup commented 8 years ago

No problem!

Hmm. Can you check which commit you're on?

cd(Pkg.dir("Mongo")) do 
    run(`git log -1`)
end
paulstey commented 8 years ago

Running

cd(Pkg.dir("Mongo")) do 
    run(`git log -1`)
end

returns the following:

Merge: 9c07214 e4deb90
Author: Peter Zion <peter.zion@gmail.com>
Date:   Sun Feb 28 21:10:42 2016 -0500

    Merge pull request #15 from ivirshup/collection_vars

    Add client, db, and name variables to MongoCollection.
ivirshup commented 8 years ago

That all seems good.

Could you run the following commands in a fresh process and copy and paste the whole session?

Pkg.update()
using Mongo
command_simple
whos(Mongo)
paulstey commented 8 years ago

Thank you! It looks like it's working now! Here is the output.

julia> Pkg.update()
INFO: Updating METADATA...
INFO: Updating cache of Libz...
INFO: Updating cache of StatsBase...
INFO: Updating cache of Compat...
INFO: Updating cache of StatsFuns...
INFO: Updating cache of Showoff...
INFO: Updating cache of MathProgBase...
INFO: Updating cache of MixedModels...
INFO: Updating LibBSON...
INFO: Updating Mongo...
INFO: Updating MySQL...
INFO: Updating GraphPlot...
INFO: Computing changes...
INFO: Upgrading Compat: v0.7.14 => v0.7.17
INFO: Upgrading Libz: v0.1.0 => v0.1.1
INFO: Upgrading MixedModels: v0.5.0 => v0.5.1
INFO: Upgrading Showoff: v0.0.6 => v0.0.7
INFO: Upgrading StatsBase: v0.8.0 => v0.8.1
INFO: Upgrading StatsFuns: v0.2.0 => v0.2.1
INFO: Building Homebrew
INFO: Recompiling stale cache file /Users/pstey/.julia/lib/v0.4/Compat.ji for module Compat.
INFO: Recompiling stale cache file /Users/pstey/.julia/lib/v0.4/JSON.ji for module JSON.
INFO: Recompiling stale cache file /Users/pstey/.julia/lib/v0.4/SHA.ji for module SHA.
INFO: Recompiling stale cache file /Users/pstey/.julia/lib/v0.4/BinDeps.ji for module BinDeps.
HEAD is now at f0b70e5 update: fix hyphen counting (legacy tap renaming)
HEAD is now at c377b50 Merge pull request #92 from staticfloat/staging
INFO: Building NLopt

julia> using Mongo

julia> command_simple
command_simple (generic function with 3 methods)

julia> whos(Mongo)
                         Mongo    958 KB     Module
                   MongoClient    124 bytes  DataType
               MongoCollection    148 bytes  DataType
                   MongoCursor    112 bytes  DataType
              MongoDeleteFlags     32 bytes  Module
              MongoInsertFlags     32 bytes  Module
               MongoQueryFlags     80 bytes  Module
              MongoUpdateFlags     40 bytes  Module
                command_simple   2766 bytes  Function
                         count   9366 bytes  Function
                        delete   4491 bytes  Function
                          done    197 KB     Function
                            eq    509 bytes  Function
                          find     20 KB     Function
                            gt    509 bytes  Function
                           gte    509 bytes  Function
                            in     39 KB     Function
                           inc    529 bytes  Function
                        insert   4430 bytes  Function
                            lt    509 bytes  Function
                           lte    509 bytes  Function
                           max     19 KB     Function
                           min     19 KB     Function
                            ne    509 bytes  Function
                          next    249 KB     Function
                           nin    509 bytes  Function
                       orderby    529 bytes  Function
                         query    529 bytes  Function
                           set    529 bytes  Function
                          show    158 KB     Function
                         start    204 KB     Function
                        update   4680 bytes  Function
paulstey commented 8 years ago

Just so I understand, why was I having this problem?

ivirshup commented 8 years ago

I can't be %100 sure, but I think it's just having to start a new repl to be able to access a changed module brought into scope with using. If you use import often you can use reload("module"), but I'm not sure if that still holds with potentially changing binary dependencies.

paulstey commented 8 years ago

Okay, I see. Thank you so much for your help and also for your work on the package!