Giter Site home page Giter Site logo

connect/6 example about mongodb-erlang HOT 11 CLOSED

comtihon avatar comtihon commented on July 24, 2024
connect/6 example

from mongodb-erlang.

Comments (11)

TheSquad avatar TheSquad commented on July 24, 2024

If you do not have auth use connect/2. It is not documented yet I have made a pull request earlier this week.

from mongodb-erlang.

cystbear avatar cystbear commented on July 24, 2024

I still need full-featured connection example. Thanks

from mongodb-erlang.

TheSquad avatar TheSquad commented on July 24, 2024

Here :
mongo:connect(<<"DB">>, [{host, _Host},{port, _Port}])

from mongodb-erlang.

cystbear avatar cystbear commented on July 24, 2024

@TheSquad nope, I mean example of connect/6
especially how to set just empty username and password, when I have not any auth at all.

from mongodb-erlang.

TheSquad avatar TheSquad commented on July 24, 2024

@cystbear you can't use connect/6 if you do not have any auth, it won't work, that's is why I created connect/2, to connect to a remote server without credentials.

from mongodb-erlang.

comtihon avatar comtihon commented on July 24, 2024

First of all you can use mongo:connect(Database, Options). It was merged in mongo master some time ago.
You may notice, that mongo:connect is a wrap around mc_worker:start_link, which takes proplist of different settings, as argument.
So - if you need something more, than is in mongo:connect - use mc_worker:start_link with your settings.

from mongodb-erlang.

cystbear avatar cystbear commented on July 24, 2024

@comtihon how to provide empty username/password ?

{<<"test">>, <<>>, <<>>, slave_ok, unsafe, []}

or how?

from mongodb-erlang.

comtihon avatar comtihon commented on July 24, 2024

If you have no auth on database - do not set username and password in options using mongo:connect/2 or do not include them in proplist when using mc_worker:startlink

from mongodb-erlang.

cystbear avatar cystbear commented on July 24, 2024

@comtihon but I do not know in advance will user use auth or not, so I am trying to do some universal solution. All params for connection will come from config. That's it.

from mongodb-erlang.

TheSquad avatar TheSquad commented on July 24, 2024

if you wrap a solution around mongodb, then it is up to you to use connect/2 or connect/6 if your user use auth or not...

from mongodb-erlang.

cystbear avatar cystbear commented on July 24, 2024

ok

from mongodb-erlang.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.