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

MongoDB filtetype javascript #193

Open
chrstnwhlrt opened this issue Sep 23, 2023 · 6 comments
Open

MongoDB filtetype javascript #193

chrstnwhlrt opened this issue Sep 23, 2023 · 6 comments

Comments

@chrstnwhlrt
Copy link

Every query buffer is automatically set to filetype sql (which works hand in hand with the autocomplete plugin). Using MongoDB as my main database type filetype javascript would be more helpful (as the lsp can kick in and help with formating the queries for example). Is there any way to configure the filetype? (:set filetype=javascript does the job)

@chrstnwhlrt
Copy link
Author

I'm not an lua programmer but this is the place where the filetype of the db which is used for the new buffers defaults to sql correct?

image

@BioWare
Copy link

BioWare commented Oct 18, 2023

could you please help me with my problem?
I'm running mongodb with docker, from offical mongodb image.
I can connect to this db with studio3t
But when i'm tring to connect to this db with DBUI i have error "Error connecting to db mongo: 'mongosh' executable not found"
My url is: mongodb://localhost:27017 (this url also in studio3t)
Looked to google, can't find answer.
Where is my problem? Thanks

@gusilva
Copy link

gusilva commented Oct 19, 2023

Hi @BioWare. You need to install the mongosh. If you use ubuntu, you can follow this steps:

  1. sudo apt-get install gnupg curl
  2. curl -fsSL https://pgp.mongodb.com/server-7.0.asc |
    sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg
    --dearmor
  3. sudo touch /etc/apt/sources.list.d/mongodb-org-7.0.list
  4. echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
  5. sudo apt-get update
  6. sudo apt install mongodb-mongosh

Reference: https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/#install-mongodb-community-edition

@BioWare
Copy link

BioWare commented Oct 19, 2023

Hi @BioWare. You need to install the mongosh. If you use ubuntu, you can follow this steps:

  1. sudo apt-get install gnupg curl
  2. curl -fsSL https://pgp.mongodb.com/server-7.0.asc |
    sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg
    --dearmor
  3. sudo touch /etc/apt/sources.list.d/mongodb-org-7.0.list
  4. echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
  5. sudo apt-get update
  6. sudo apt install mongodb-mongosh

Reference: https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/#install-mongodb-community-edition

Hello @gusilva thanks for your answer.
So even if im using docker i have to install mongosh localy right?

@gusilva
Copy link

gusilva commented Oct 19, 2023

@BioWare, I suppose you use a docker container to provide a MongoDB server. That being said, to connect to this MongoDB container, you need a Mongo client. Dadbod uses mongosh or mongo, which should be installed in the environment where your nvim is running. Studio3T has its Mongo client packaged with its program, that's why you are able to connect via Studio3T to the MongoDB container.

@BioWare
Copy link

BioWare commented Oct 20, 2023

@BioWare, I suppose you use a docker container to provide a MongoDB server. That being said, to connect to this MongoDB container, you need a Mongo client. Dadbod uses mongosh or mongo, which should be installed in the environment where your nvim is running. Studio3T has its Mongo client packaged with its program, that's why you are able to connect via Studio3T to the MongoDB container.

got it. Thanks for your help

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

No branches or pull requests

3 participants