microsoft / vscode-mongodb Goto Github PK
View Code? Open in Web Editor NEWMongoDB extension for Visual Studio Code
Home Page: https://marketplace.visualstudio.com/items?itemName=ms-vscode-devlab.vscode-mongodb
License: MIT License
MongoDB extension for Visual Studio Code
Home Page: https://marketplace.visualstudio.com/items?itemName=ms-vscode-devlab.vscode-mongodb
License: MIT License
if i execute exit
by pressing F8
and then try to run another command such as show dbs
I get the following Error:
Error: This socket has been ended by the other party
Refreshing the explorer resets everything so that I can run commands again.
when i try to write command in the "Scrapbook" and to run it, and i find out that it can only work when i run selected command on the first line.And also the IntelliSense works for the only first line.
I wonder it's my owm problem or it's the way works.
Say I click on a collection and am shown the results in a json format, when I remove an entry in the json representation now and click update, it should be removing that entry right?
The nRemoved count should be 1, instead I get this:
{
"ok": 1,
"writeErrors": [],
"writeConcernErrors": [],
"insertedIds": [],
"nInserted": 0,
"nUpserted": 0,
"nMatched": 10,
"nModified": 10,
"nRemoved": 0,
"upserted": []
}
Am I completely misunderstanding this tool somehow?
After connecting to Replica Set (Atlas) URL I can see the MongoDB connection as the name of the first cluster, I can see the databases in there, but when trying to see the contents of the database all I get is an error saying: "double colon in host identifier".
Any workarounds?
Testing microsoft/vscode#25332
var let = db.inventory.find({status: "A", qty: { $lt: 30 }})
re
Error in console: 'INVALID text edit -> must be single line and on the same line'
The example likely doesn't make any sense...
Change from CMD + ` (cmd plus back tick) to CMD+' (cmd plus single quote)
We should persist the latest connected MongoDB instance so that the user doesn't have to click 'connect' when they re-open VS Code
this fails with "unexpected token i in JSON at position 2". Note the space between {
and id
:
db.stickers.insertMany([
{ id: '1',
tags: [ 'Deployment' ],
name: 'Docker',
description: 'The Docker container-based platform deployment system',
author: 'Docker',
size: {
width: '2in',
height: '2in'
},
image: '/img/logo/docker.png'
}, {
id: '2',
tags: [ 'Service' ],
name: 'Trello',
description: 'The Trello project management service',
author: 'Trello',
size: {
width: '2in',
height: '2in'
},
image: '/img/logo/trello.png'
}
])
This works (note no space between the first {
and id
):
db.stickers.insertMany([
{id: '1',
tags: [ 'Deployment' ],
name: 'Docker',
description: 'The Docker container-based platform deployment system',
author: 'Docker',
size: {
width: '2in',
height: '2in'
},
image: '/img/logo/docker.png'
}, {
id: '2',
tags: [ 'Service' ],
name: 'Trello',
description: 'The Trello project management service',
author: 'Trello',
size: {
width: '2in',
height: '2in'
},
image: '/img/logo/trello.png'
}
])
Steps to Reproduce:
Expected: An autocompleted list of collections and functions pops up
Actual: No list pops up and this error is displayed:
[Error - 4:15:30 PM] Request textDocument/completion failed.
Message: Request textDocument/completion failed with message: pool destroyed
Code: -32603
NOTE: This problem isn't the most consistent to repro. Try opening up multiple scrapbooks and typing 'db.' in each to see if it repros.
running on windows 10...
add a new connection
result: the Mongo tree is not updated to see the connection
press refresh button
result: same, no connection in the tree
reload/restart VS Code
result: now i can see the connection and work with it
drop a database
result: database is still in the tree
reload/restart VS Code
result: now the database is removed from the tree
i dont see this on Mac, only windows
With the latest VS Code x64 v1.16.1, hitting the 'Add Server' button on the extensions gives the Error "command 'mongo.addServer' not found.
This was previously working but I recently updated to v1.16.1 and the extension started providing this error shortly after.
While testing microsoft/vscode#25332
Intellisense should knowdb
as a predefined name
Repro steps:
Expected: A new scrapbook opens
Actual: 'Error command mongo.newScrapbook not found'
This error occurs because we depend on ExtensionContext.storagePath, which is undefined if no workspace is open. We should use globalState instead so that settings are persisted across workspaces and since it should always be defined
platform: windows
running from source in latest insiders build (may 22)
steps to reproduce:
connect to mongodb://localhost:27107
click on a database, and then a connection
result: status bar indicates that we are connected to the database...
add a new scrapbook file using the new scrapbook button
in scrapbook, type in db.
result: no intellisense
open command palette, type in >Mongo: Connect Database
and choose the database
in .mongo
scrapbook, now I get IntelliSense, etc.
The problem is that the status bar and the ability to click on a collection and see the top "X" records makes you think you are connected to the database. I kind of like the idea of clicking on the database/collection to set the active connection. but, i would want to try it first.
While testing microsoft/vscode#25332
When you run your database on mlab you get a multi-tenant setup. I.e. a single mongo server has multiple databases but you are only allowed to access the db you own.
The mongoshell handles that case without issues:
mongo mongodb://<dbuser>:<dbpassword>@<server>.mlab.com:55574/<database>
works without issues.
When I try to use such a connection string the in extension I get an error since the extension tries to list the databases:
not authorized on admin to execute command { listDatabases: 1 }: MongoError: not authorized on admin to execute command { listDatabases: 1 }
Was reading through the repo and found this in mongoScript.ts:
private jonLanguageService: JsonLanguageService
in the MongoScriptDocumentManager
class. I assume jonLanguageService
should be jsonLanguageService
. Unless "jon" is the internal Microsoft name for "json" :D
As it's a private member I don't think its breaking anything else, but I figured I'd report it anyway.
Auto trigger intellisense with .
character
I have a database in my local mongo called admin
and it has a collection called system.version
. I don't know where it came from unfortunately. I don't see the system.version
collection in compass:
In VS Code, it looks like this (with errors):
When I click on the system.version
node, I get prompted to enter the path to mongo shell in the Command Palette I put in the following:
c:\program files\mongodb\server\3.4\bin
which creates the following setting:
"mongo.shell.path": "C:\\Program Files\\MongoDB\\Server\\3.4\\bin"
When I click on the system.version
node in the explorer, I get two errors:
Timed out executing use admin
Error: write EPIPE
So there are two issues here:
mongo.exe
is, or the full path to mongo.exe
. I did just the path and ran into problem 2Testing microsoft/vscode#25332
_test.mongo
editor is open againError dialog: 'Please connect to the database first'
I have to open the test editor again.
It would better if reconnecting happens automatic.
Steps to reproduce:
Here I can see two problems:
My computer has the following applications installed:
For more information please check the attachment.
Testing microsoft/vscode#25332
db.
new mongo scrapbook
use stickerDatabase
press cmd+'
to execute command
result:
Running the contributed command:'mongo.execute' failed.
Testing microsoft/vscode#25332
db.getCollectionNames()
I'm on Windows version of VS Code version 1.18.1, have mongo v3.4.4.
In a Scrapbook, I have this command:
db.<collection>.find({"_id": ObjectId("5a12639c9e07f595e0c79c89")})
and I get this error:
ObjectId is not defined
Have also tried with ObjectID.
Am sure this will be a basic issue. Any ideas?
We should either provide a 'load more' option or let the user configure how many docs they want to retrieve
Testing microsoft/vscode#25332
If the result is a JSON, it should be formatted. Everything on one line is not useful
While testing microsoft/vscode#25332.
The extension should provide intellisense on properties and potentially property values when creating a query.
For example:
db.user.find({name: 'kiefer'})
Intellisense support could be provided for name
and for kiefer
.
Similarly, there should be intellisense support when constructing a projection:
db.user.find({}, { name: 1})
Intellisense support could be provided for name
.
Try running this from a mongo document (any collection, does not matter if its stickers):
db.stickers.find({}, {"_id":0})
The result will still contain the _id
field.
Run the same query from the Mongo shell and the _id
field is not in the result set.
It is not just the _id
field, you can't do any projection such as:
db.stickers.find({}, {"name":1, "_id":0})
Testing microsoft/vscode#25332
I had a hard time to figure out how 'Execute script' works. I always put the cursor after an expression and expected it to be evaluated.
IMO if the current selection is empty, I suggest to run the line on which the cursor is.
Expected: A new file is opened (or at the very least a nice error message)
Actual: "Error: Path must be a string. Received undefined."
New to Visual Studio Code, new to Node.js and new to mongodb. I am running OS X 10.12.X
My mongodb is an instance on atlas, so the mongo server is NOT running locally.
node --version is v9.2.1
I can connect to my mongodb using the shell access tool from mongdb. I can connect to my mongodb instance using a PHP script on my computer.
I can invoke my js script via the command-line / node, and it connects to my mongodb instance.
However, when I invoke my js script from inside Code, I get this error as reported in file "fs.fs" and in the function "fs.existsSync":
Exception has occurred: Error
Error: ENOTDIR: not a directory, stat '/Users/gene/MusicDB/node_modules/require_optional/index.js/package.json'
at fs.existsSync (fs.js:346:13)
at find_package_json (/Users/gene/MusicDB/node_modules/require_optional/index.js:14:9)
at find_package_json_with_name (/Users/gene/MusicDB/node_modules/require_optional/index.js:34:20)
at require_optional (/Users/gene/MusicDB/node_modules/require_optional/index.js:69:13)
at Object. (/Users/gene/MusicDB/node_modules/mongodb-core/index.js:8:20)
at Module._compile (module.js:641:30)
at Object.Module._extensions..js (module.js:652:10)
at Module.load (module.js:560:32)
at tryModuleLoad (module.js:503:12)
at Function.Module._load (module.js:495:3)
I am able to connect to a locally-running mysql server from inside Code. I've installed several other npm packages just to see if I could use them, and none of them have had any problems. Only the mongodb package appears to have an issue. I have since removed all references to node and npm and did a fresh install with only "mysql" and "mongodb" being installed by me. Still, no luck.
Testing microsoft/vscode#25332
Under Windows :
is a special character and cannot be used in file names.
right now, the connection is always shown in the status bar. we could only show it when a scrapbook document is open.
localhost:27017
localhost:27018
docker-compose
file)docker run -p 27018:27017 mongo
27017
db.collection.find()
and copy the results27018
db.collection.insertMany([{...}]
and paste in the clipboard contentsresults
insertMany
would simply stop working and at that point I couldn't connect to any database. Had to reload VS Code to reset everything.What i'm trying to do is get data into a running mongo container because once the container is stopped all data is lost.
Steps to repro:
Expected: It creates a scrapbook with '2' in the name since a file already exists with '1' in the name
Actual: Nothing happens: no file is opened and no error is shown
Should we automatically try to open mongodb://localhost
when the extension starts? many (most?) will probably have mongo installed locally so its one less thing they have to do.
add a connection to a mongodb server
right click on the database, choose "Connect"
result: no status in the status bar
Now, add a new .mongo scrapbook file
Result: connection is shown in the status bar
expectation: as soon as i say "connect" show the connection in the status bar.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.