ScottPJones / Mongo.jl

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

Authentication support #12

Open IanButterworth opened 8 years ago

IanButterworth commented 8 years ago

Is Mongodb authentication supported? or likely to be added?

I have a mongodb that must be authenticated, but this appears to be the best Julia package I can find to interact with it.

ghost commented 8 years ago

Hi there, it may be possible to specify authentication details in the URL itself, see: https://docs.mongodb.org/v3.0/reference/connection-string/

If not, it should be easy to add support, and contributions are welcome!

IanButterworth commented 8 years ago

Ok great, thanks for the tip. edit: and I'm happy to contribute if I figure out a good method!

I've tried to do so via the URL, but hit the error below:

using Mongo
client = MongoClient("user:password@servername.com/databasename",27017)
collection = MongoCollection(client, "databasename", "collectionname")
oid = insert(collection, Dict("name"=>"New", "value"=>1))

LoadError: insert: 
Invalid reply from getnonce
while loading In[2], in expression starting on line 16

 in error at ./error.jl:21
 in insert at /home/juser/.julia/v0.4/Mongo/src/MongoCollection.jl:45
specter119 commented 8 years ago

@ianshmean @pzion the user and password in URL have no effect on authentication in pymongo. I think authentication is needed, for the dbs can't accessed without password.