Open chrstnwhlrt opened 1 year ago
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?
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
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
Hi @BioWare. You need to install the mongosh. If you use ubuntu, you can follow this steps:
- sudo apt-get install gnupg curl
- curl -fsSL https://pgp.mongodb.com/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor
- sudo touch /etc/apt/sources.list.d/mongodb-org-7.0.list
- 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
- sudo apt-get update
- sudo apt install mongodb-mongosh
Hello @gusilva thanks for your answer. So even if im using docker i have to install mongosh localy right?
@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, 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
I have the same problem as the original ticket author. I work almost exclusively with mongodb and the sql filetype in the query window is making it more difficult than it has to be.
If the query pane filetype could be switched to javascrip, it will allow block comments from plugin to use the correct prefix, apply autoformatting correctly etc. At the moment the editor thinks the blank query window is of type sql and will do block comments with --
instead of //
.
I pushed a change to master that should make mongodb query buffers a js
filetype.
Is there a way with the new js
filetype change to load omnifunc completions for the DBUI only? The sql
filetype was a bit more exclusive but js
is not as distinguishable.
I'm not sure if and how well does mongodb autocompletion works. We could set some buffer variable and distinguish by that, but first we need to generally test the mongodb support both here and on completion. I'm not a mongodb user, so I'm open to PRs to address any potential issues.
That makes sense, looks like the table names are the only items completed at the moment so not a huge deal either way.
Having a more generalised way to detect DBUI running could also give an alternative for setting the default keymaps as now <Leader>W
is not mapped, for example. Easy to manually set these as the user but wanted to note that here too :)
Just wanted to note that with this change d2ffc1b, queries no longer execute for Mongo buffers. I had to explicitly set the file type to sql to make my mongo queries execute. For anyone running into this you can simply:
set filetype=sql
in a buffer and you can then execute the query.
@brandonfouts can you provide some more information? It executes fine for me. Are you using the latest master branch?
@brandonfouts I assume you meant there are no mappings to manually execute the query and similar. I pushed a fix for that, let me know if it's still broken.
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)