perak / extract-mongo-schema

Extract schema from Mongo database, including foreign keys
71 stars 22 forks source link

extract schema how to connect url #1

Open srs123 opened 6 years ago

srs123 commented 6 years ago

I have mongo server url only my credential how to connect ?

i connect my url link some error "mongodb://QryUser3:Welqr7%40abc1@localhsot:27017/admin?readPreference=secondaryPreferred&replicaSet=test/test_db"

perak commented 6 years ago

I see “localhsot” instead “localhost” in the url

srs123 commented 6 years ago

example 192.168.1.10:27017 this server ip . how to connect url using schema extract ? its possible ?

pvcon13 commented 4 years ago

Same question. under -d connectionstring I added username and password without a database name and if shows the top level structure in drawn html perfectly (thank you).

But if I then add at the end of the connection string (with the auth) the database name it throws a security exception.

So the connect string connects just find with username and password, .... but how do I select a database name on the command line?

I have 5 databases each with 1 to 4 collections. I do not mind outputting one at a time, just do not understand the syntax.... or do I have to change the security to permit this? Its an online system.

Any ideas would be great. Really love this tool for documenting Mongo.

pvcon13 commented 4 years ago

When I use Mongo in this app, I connect first, then select DB and issue command with db. and that works if the security is only at the connection stage.

Reading you code it looks like to connect directly to the db? Is that the issue? var getSchema = function(url, opts) { var db = wait.forMethod(MongoClient, "connect", url);

var l = db.listCollections();
var collectionInfos = wait.forMethod(l, "toArray");
var schema = {};
var collections = {};