The localhost of Mongod does not seem to be connecting properly with the 'npm start' command of my program

I'm currently developing a prototype program that handles account registrations, and my approach involves utilizing Node.JS to write JavaScript code that can be utilized on mobile devices.

After downloading MongoDB and setting up the data/db directory to support it, using version 4.0.2 to ensure compatibility with Windows 8.1, I attempted to run the mongod command in the command prompt to initiate the local server with npm. However, it seems that MongoDB is not functioning correctly. The error messages displayed are as follows:

C:\Users\user>mongod
2021-08-03T17:40:37.119-0300 I  CONTROL  [main] Automatically disabling TLS 1.0,
 to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2021-08-03T17:40:38.707-0300 W  ASIO     [main] No TransportLayer configured dur
ing NetworkInterface startup
2021-08-03T17:40:38.710-0300 I  CONTROL  [initandlisten] MongoDB starting : pid=
3624 port=27017 dbpath=C:\data\db\ 64-bit host=user-pc
...
2021-08-03T17:40:42.126-0300 I  SHARDING [ftdc] Marking collection local.oplog.r
s as collection version: <unsharded>

What steps should I take to resolve this issue and make MongoDB work correctly?

Answer №1

Your MongoDB instance is functioning properly, as indicated by the following log entries:

2021-08-03T17:40:41.951-0300 I  NETWORK  [listener] Listening on 127.0.0.1
2021-08-03T17:40:41.952-0300 I  NETWORK  [listener] waiting for connections on port 27017

This confirms that your Mongo is running smoothly. However, there seems to be an error indicating:

UnhandledPromiseRejectionWarning: MongoError: Authentication failed.

This suggests that there might be an issue with your credentials (username and password), and you are also missing error handling when attempting to connect to MongoDB (using a try/catch block), leading to the UnhandledPromiseRejectionWarning

npm start is a standard npm script for launching your application and is unrelated to your MongoDB instance.

I recommend downloading Robo3T (or another client) to verify if you can establish a connection to your MongoDB instance there first. Once successful, you can proceed with testing the connection from Node.js

I hope this explanation helps clarify the situation :)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for setting up OpenLayers demonstrations on a personal server?

Currently, I'm working with an older version of OpenLayers (4.6.2) and find the provided examples extremely helpful for testing and reference purposes. However, the official web page with updated examples only includes the latest version. I am wonder ...

Issue with pushing inner list<object> in Knockout version 3.2.0

Currently, I am working with knockout.js on an ASP application. The issue I am facing involves a list of objects returned by the controller action to the view, where the objects in the list point to another list of objects. My struggle lies in adding new o ...

Inserting items into an array entity

I am attempting to insert objects into an existing array only if a certain condition is met. Let me share the code snippet with you: RequestObj = [{ "parent1": { "ob1": value, "ob2": { "key1": value, "key2": va ...

jQuery Multi-select - Event Handler for Selecting All Items

I am currently using a jQuery multiselect that has the select all option checked by default. When there is a change in the selected options, I reload the page data accordingly. Everything is working well except for the fact that clicking the 'Select ...

Troubleshooting: Issue with Chrome's CSV Export Functionality in JavaScript/AngularJS

Currently, I am troubleshooting an issue with exporting a CSV file from a data table on a web application. The export functionality works fine on all browsers except for Chrome when the export button is clicked. I have been trying to solve this problem for ...

Is it possible to incorporate a fadein animation into a function?

Developing the entire HTML structure using JavaScript is one of my skills. Here is a snippet as an example: function generateHeader () { $('body').append( $('<header>') .attr('id', "main-header") ...

Is there any issue that you can spot with this js / jQuery code?

Presented below is a script that prompts the user to confirm clicking a button based on a system setting. The system setting is saved in a hidden field established from the code-behind. Markup: <asp:HiddenField ID="hfConfirmOnApproval" runat="server" ...

issues encountered when trying to integrate bootstrap.js in Django framework

My website is built using the Django templating engine with Bootstrap for design and basic JavaScript. While the CSS components from Bootstrap are working fine, I'm having trouble getting the JavaScript to work: {% load staticfiles %} <!d ...

Remove the JSON object by comparing IDs between two JSON objects in JavaScript or Node.js, deleting it if the ID is not found

let data = fetchData(); let anotherData = getAnotherData(); let result = data.reduce((accumulator, current) => { if (!accumulator[current.system.name]) { accumulator[current.system.name] = {}; } let detailsObject = {}; Object.keys(current. ...

What is the easiest way to transform this json data into plain text format?

Snippet: if (message.content.startsWith(config.prefix + 'shop')) { const shop = LabyMod.getShop('all').then(shop => shop.map((sh) => sh.name)); const awaitShop = await shop console.log(JSON.stringify(awaitShop)) ...

What is the method to reach a named parameter within a function?

Currently, I am building a RESTful web service using Node JS in combination with Backbone JS. Within this service, there is a specific REST method called GET /users/id/:id, where :id represents the user's identification number. The purpose of this met ...

Resize the main container to fit the floated elements

I've been working on constructing a family tree, and the last part of the functionality is proving to be quite challenging for me. My family tree consists of list elements that are all floated to the left. Currently, when the tree expands beyond the ...

Sending parameters to a personalized Angular directive

I am currently facing a challenge in creating an Angular directive as I am unable to pass the necessary parameters for displaying it. The directive code looks like this: (function () { "use strict"; angular.module("customDirectives", []) .directive ...

Error message: When attempting to access firebase data in our app, an uncaught TypeError is thrown, stating that it is unable to read properties of undefined while trying to access '

While using Firebase 9 and Vue3, I encountered an error when trying to access data from a document. Even though the data was correctly logged in the console, it was showing up as undefined. Additionally, I made sure that the data was loaded before attempti ...

JavaScript utilizing a PHP variable

In my attempt to merge a PHP variable with JavaScript, I aim to access the "the_link_to_the_page_I_want". window.onload = function openWindow() { window.open('the_link_to_the_page_I_want', 'newwindow', config='height ...

What is the best way to utilize the data being returned from PHP in JQuery or JavaScript?

There's an AJAX request hitting a php file to fetch some data, which looks like this: 21-12-12:::visits;45;;pageviews;344---22-10-10:::visits;71;;pageviews;34---15-01-11:::visits;4;;pageviews;30 Do you see the pattern? It resembles a multidimensiona ...

What is the best way to initiate a slideshow using an external .js file?

Having an issue with my slideshow. When I put the CSS and JavaScript code in the same page, it kind of "works" but quickly goes transparent, which is not ideal for me. I prefer keeping things organized with separate files - one for each. However, when I mo ...

Issue with MiniCssExtractPlugin during compilation of the entry point build

We have integrated webpack into our deployment process to bundle resources efficiently. However, we are now facing a challenge as we aim to include the bundling of sass files through webpack in order to streamline our build process. The MiniCssExtractPlugi ...

What is the best way to instantly validate a form in React before submitting?

Having trouble with my form validation. The issue is that after validating the form on submit, I have to click the submit button a second time to actually send it and see the console.log at the bottom of the file. Any ideas on what might be causing this a ...

Attaching a function to the "onselect" event that manages the character limit within an input text field

I have been developing a function to restrict the number of characters a user can enter into a text field. Here's what I have so far: $.fn.restringLength = function (id, maxLen) { $(id).keypress(function(e){ var kCode = ...