![]() ![]() After that’s completed, run brew tap mongodb/brew.Open “Rosetta Terminal” and run the following to install Homebrew (this will take a few minutes to compete).Another quick way to find this later is the invoke Spotlight Search via “command + space”, then search for “Rosetta”. (Optional) Drag the new “Rosetta Terminal” into your dock so you have easy access to it later.To do so, run the following commands, mongoĭb.sample. Now, inserting data into a MongoDB database is somewhat simpler, especially if you have been coding in Javascript. Let’s insert data into our local MongoDB database What’s happening in Step 2 and 3? we are just making sure the user running the MongoDB service has the right directory permissions. Then run the following commands on the command line. Next up, How to setup local MongoDB database (Mac) Hence, in case you have not already done so, install HomeBrew on your mac by following the instructions here. The installation instructions I provide rely on using Homebrew. ![]() Remember, I am doing this just to practice working with MongoDB, so the free community version of MongoDB should work just fine. Hence my installation skills rely on using the command line. I use a Macbook at work and a Ubuntu at home, so both unix based operating systems. In this situation my goal was that I am building a solution with NodeJS and MongoDB and the first thing I could think of was to have MongoDB database running on localhost. When I work with new tech or solving any problem really, my first goal is to decompose it into sub-problems and solve the most basic problem. I my mind I knew how to setup a local MongoDB database would be quite simple yet for some reason it simply wasn’t as straightforward as I thought. Now, I hadn’t worked with this combination (NodeJS + MongoDB) before, I came across a few hurdles when setting up a local MongoDB instance. It’s difficult for me to find the time to do that at work, so I am doing this after hours. All those solutions fixed the issues assigned to me but I felt I should have my own MongoDB and NodeJS playground to understand the basics of it. As a result, I have written heaps (lots) of code and solved number of problems over the last 4 months. The focus is heavily on building fast and shipping things. Now, my workplace can be a little fast paced, in that every request is a priority, it has to be done ASAP. I started working with this tech at my workplace on a new project. I cannot say either of these technologies are entirely new to me, I have built a backend with Node before and I have worked with a NoSQL database before. good times □Īnyway, fast forward 10 years and I now find myself working on a “modern backend” which includes NodeJS and MongoDB. Ahh… I fondly remember the days of finding that mysql connector jar file, adding it as a dependency to my Dynamic Web project in Eclipse IDE and then the JDBC connector…. A lot of my experience has been around relational databases, be it MySQL, SQL Server, Oracle or PostgreSQL. I am of course talking about a time before Spring initializr made life easy. I am an old timer, I have been around since the days when Java or J2EE would take a couple of days to just setup. MongoDB Compass NodeJS and MongoDB Setup a NodeJS project… Connect to MongoDB database Summary Background Background Working with new tech Setup MongoDB on a Macbook How to setup local MongoDB database (Mac) Let’s insert data into our local MongoDB database Command line is great but….
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |