Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: how to see existing databases #539

Closed
thoefkens opened this issue Feb 2, 2025 · 2 comments
Closed

Question: how to see existing databases #539

thoefkens opened this issue Feb 2, 2025 · 2 comments
Labels

Comments

@thoefkens
Copy link

Hi all,

I have set up restheart to connect to mongo using via Docker:

/mclient/connection-string->"mongodb://admin:password@mongodb:27017/?authSource=admin";

Once I start up mongo and restheart I can only see the "acl" and "users" Endpoints when I curl localhost:8080

However, I do not seem to be able to get restheart to show existing databases and collections in my MongoDb.

When I call localhost:8080/db it tells me the collection does not exist - even though there is a database db in mongo which the admin user can access (as configured above).

Restheart seems to shows me only the collections in the "restheart" database it created.
I already tried setting an ACL with all db access in the restheart acl collecition - and in Mongo, the admin user has all rights on all databases.

What am I misconfiguring?

Thank you
Thomas

@mkjsix mkjsix added the question label Feb 3, 2025
@mkjsix
Copy link
Member

mkjsix commented Feb 3, 2025

Hi @thoefkens

For security reasons the default RESTHeart's configuration only mounts the "restheart" database.

  mongo-mounts:
    - what: /restheart
      where: /

If you look at the above link there's an example in a comment:

  # Examples:
  # The following exposes all MongoDb resources.
  # In this case the URI of a document is /db/coll/docid
  #
mongo-mounts:
  - what: "*"
    where: /

Have a look here for examples on how to set the proper RHO environment variable.

In your case this should work:

/mclient/connection-string->"mongodb://admin:password@mongodb:27017/?authSource=admin"; /mongo/mongo-mounts[1]->{"where: "/", "what": "*"}'

@thoefkens
Copy link
Author

Thank you @mkjsix - I sort of figured out last night how to use the /mongo/mongo-mounts array and it worked - hope this answer will help other people - you have to dig a bit in the docs to figure it out :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants