Giter Club home page Giter Club logo

Comments (5)

GeoffreyPlitt avatar GeoffreyPlitt commented on May 24, 2024

In case it isn't clear, the connection string is correct, I can connect to that database with those values when I use another client. This seems to be an issue with mongojs.

from mongojs.

mafintosh avatar mafintosh commented on May 24, 2024

The connection string you share in this issue - is that exact connection string valid? Because I get an auth error as well when using it with the mongo terminal console.

from mongojs.

GeoffreyPlitt avatar GeoffreyPlitt commented on May 24, 2024

I see what you mean; I was able to successfully connect by specifying the auth db:

mongo -u root -p s6m3ta7I9w711vCN2Xgz margindev-geoffmaker-db-0.azva.dotcloud.net:40769/maker_ad_planner --authenticationDatabase admin

Is there an equivalent of "--authenticationDatabase" in mongojs ?

from mongojs.

sorribas avatar sorribas commented on May 24, 2024

I know it is a bit late but according to the driver documentation you can use the authSource option in the connection string to set the authentication database. You might want to give it a try.

from mongojs.

balachandertgm avatar balachandertgm commented on May 24, 2024

Hi,
when i use find method i got auth error.

code:
var databaseUrl = "mongodb://root:mean@localhost:/mydb";
var collections = ["users", "reports"]
var mongojs = require('mongojs');
var db = mongojs("mydb",['mycollection']);

db.mycollection.find({sex: "female"},function(err, docs) {
// docs is an array of all the documents in mycollection
console.log(err);
console.log(docs);
});

error:
mongodb\lib\mongodb\mongo_client.js:460
throw err
^
MongoError: auth failed
at Object.toError (C:\Bitnami\meanstack-2.6.7-0\projects\mongojs\node_module
s\mongojs\node_modules\mongodb\lib\mongodb\utils.js:114:11)
at C:\Bitnami\meanstack-2.6.7-0\projects\mongojs\node_modules\mongojs\node_m
odules\mongodb\lib\mongodb\db.js:1194:31
at C:\Bitnami\meanstack-2.6.7-0\projects\mongojs\node_modules\mongojs\node_m
odules\mongodb\lib\mongodb\db.js:1903:9
at Server.Base.callHandler (C:\Bitnami\meanstack-2.6.7-0\projects\mongojs\n
ode_modules\mongojs\node_modules\mongodb\lib\mongodb\connection\base.js:453:41)
at C:\Bitnami\meanstack-2.6.7-0\projects\mongojs\node_modules\mongojs\node_m
odules\mongodb\lib\mongodb\connection\server.js:487:18
at MongoReply.parseBody (C:\Bitnami\meanstack-2.6.7-0\projects\mongojs\node

modules\mongojs\node_modules\mongodb\lib\mongodb\responses\mongo_reply.js:68:5)
at null. (C:\Bitnami\meanstack-2.6.7-0\projects\mongojs\node_modu
les\mongojs\node_modules\mongodb\lib\mongodb\connection\server.js:445:20)
at emit (events.js:107:17)
at null. (C:\Bitnami\meanstack-2.6.7-0\projects\mongojs\node_modu
les\mongojs\node_modules\mongodb\lib\mongodb\connection\connection_pool.js:207:1
3)
at emit (events.js:110:17)

from mongojs.

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.