Check out a free preview of the full Visual Studio Code Can Do That? course:
The "Working with MongoDB" Lesson is part of the full, Visual Studio Code Can Do That? course featured in this preview video. Here's what you'd learn in this lesson:

Burke demonstrates how to create, connect and update a MongoDB database using VS Code.

Get Free Access Now

Transcript from the "Working with MongoDB" Lesson

[00:00:00]
>> Burke Holland: The other way to work with MongoDB is with something called MongoDB Scrapbooks. This is part of the Cosmos DB extension. So I'm gonna Cmd+Shift+P and then I'm just gonna look for scrapbook, and choose New Mongo Scrapbook. And now I'm connected to lamp. If I type DB and hit a dot it gives me and prompts me with all the things that I can do from here with the MongoDB API.

[00:00:33] It sees that I have a colors collection so it puts that at the top collections are at the top. So I'm gonna choose colors, and then we can run a find command. If you're not familiar with MongoDB, it's okay. It's just a different API for getting data out of the database.

[00:00:48] So I'm gonna hit dot, and then we can do find. See, these are all the different things we can do on this instance. I'm gonna say find and then like this, this is all you have to do to retrieve records for MongoDB. Then we wanna execute this. So we can do execute here like this.

[00:01:06] And then here's all of our records on this side. The other option is to do Command Shift and then the double quotes button. And that is the keyboard shortcut for the same thing. Now, if we come to this side over here and we change this, and click Save, what happens?

[00:01:24] We've changed again directly from the editor. So you can see here that you can query and alter your data directly from VS Code. You don't need to drop down into the Mongo shell to do that, and you don't need another tool to do it either. Now in this same container where I've given you MongoDB, I've also given you something called SQL Lite.

[00:01:50] If you're not familiar with SQL light, it is a file based database that supports SQL. And it's frequently used in mobile applications. So a lot of the mobile apps that you have on iOS and Android use SQL light. It's a very, very good alternative. If you want to have a lightweight file based database.