Trouble connecting Node to MongoDB on Windows - node.js

I'm having a difficult time figuring out how to run a node database. It has been several months since I set it up (following a tutorial) and I can't figure out how to connect to it again.
Here is what I have tried.
cd C:\Program Files\MongoDB\Server\3.4\bin
This is the folder which node is installed. Then I run the following:
mongod --dbpath d:\njs\nodetest1\data\
Which based on the following image, I would think should be correct, as the dbpath I list contains the following:
But then when I open a new instance of the command prompt, also navigate to cd C:\Program Files\MongoDB\Server\3.4\bin and enter
mongo
show databases
The results are, two databases titled DB_DROPPED & LOCAL both wit 0GB. I thought the database I'm looking for should be titled myCases, but that isn't showing up.
Does the picture I show suggest any cause? Am I simply skipping a step to connect? The database did not contain any sensitive information and I was just setting it up to test some stuff (and therefore had not been overly concerned with figuring out security), is it possible someone came in and "dropped" (i.e., deleted) the database?

Using mongod --dbpath d:\njs\nodetest1\data\.You are setting data directory to store all data.now just start mongoDB using this command "C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe".

Related

Unable to start mongodb from vscode terminal

I'm learning nodeJS and started it up fine yesterday, yet today when I tried to do it, it just reports the following error:
Unable to create/open the lock file: "C:\Users\User\Documents\MongoDB\bin\mongod.exe\mongod.lock" (The system cannot find the path specified.)
Ensure the user executing mongod is the owner of the lock file and has the appropriate permissions. Also make sure that another mongod instance is not already running..."
After reporting the error it just shuts down. I installed it not via the msi file, but by extracting the zip archive.
The mongodb data folder is empty for some reason, and no service of mongodb is running in windows services. My account is the administrator too.
clarification sought, Is your mongo DB instance setup correctly.
I mean are you able to run command mongo from command prompt. Please give some details if you are able to run a query on mongo standalone host.
note, you need to have data and log directory before you can run mongodb services.

Error while using mongoose.I am not able to run my code and i have no idea how to get mongod services running

enter image description here
I am repeatedly getting this error while running my code.I googled it and it had something to do with mongod services not running but i dont know how to get the services started.
Your MongoDB database is most likely not running, from the path mentioned in your error, I am assuming you are running on Windows, I suggest you follow this guide: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/#create-database-directory
You are going to have to create the data directories then start the database through your terminal.

Navicat Essentials Mac Database list

I have been using Navicat Essentials for some time and all worked well.
Today I opened Navicat and it gave me a message and asked me to download again from App Store. Which I did.
Now I am able to connect with the root user but it does not show me any databases. Everything is on localhost. If i connect from the terminal using the same root user - i can see all the databases. Mysql is running on localhost and terminal connection works well.
In Navicat the only thing that I am seeing is infomarmation_schema. No other databases are coming up.
It is not a privileges issue. I already checked that. The root user has all the privileges defined in Navicat.
Has someone seen anything like this before and can help with whats going on here.
Thanks,
Deepinder
I am posting an answer to my own question. I downloaded Mysql Workbench and when I tried to connect from there - it gave me an error.
Table 'performance_schema.session_variables' doesn't exist
I searched on this and got the solution -
mysql_upgrade -u root -p --force
Then restart mysql server and everything works. I can see the list of databases in Navicat now.
Thanks

broadleaf database tables does not persist after application shutdown

I have been able to run the DemoSite project after changing the in-memory HSQL database to MySql following the instructions given in the broadleaf commerce getting started instructions for changing databases .
Now when I run the Demosite application I find 183 tables get created and populated with data , but this is in existence only during the running of the application . Once the application is shut down only 4 tables remain in the database .
I am using broadleaf demosite version 4.0.0 and MySql Database . The 4 tables which remain after application shut down are named as follows : -
blc_bank_account_payment
blc_credit_card_payment
blc_gift_card_payment
blc_static_asset_strg
I have changed the relevant properties files "hbmddl2.auto" entry value to "update" so that the database tables don't get created and erased for every new run of the application but still have not been able to get rid of this issue .
I have searched a lot also posted to the relevant forums but no answer . SOF is my last resort . Please help .
When you first run DemoSite you might have blPU.hibernate.hbm2ddl.auto=create-drop in your site/src/main/resources/runtime-properties/development.properties file in order to generate database tables.
How you are running the Site/Admin? From ant tomcat target from IDE or deploying war in tomcat outside of IDE.
I hope you have changed blPU.hibernate.hbm2ddl.auto property value to update.
Now if you are running ant tomcat from IDE, after changing the above property first you need to maven install core/site/admin modules before running site/admin.
If you are running from IntellijIDEA when you stop the application it will drop the tables if you have blPU.hibernate.hbm2ddl.auto=create-drop, where as Eclipse will immediately terminates the process without running the drop phase.
The best thing to do is when you start the application first time , after database tables are created and sample data is populated then take backup of the schema. Then change blPU.hibernate.hbm2ddl.auto to update, run maven install. Now start the application.
Hope it helps.

MongoDB out of the box: not authorized for insert (Windows 7)

I've been following along with the actual MongoDB docs here
as well as several tutorial articles that are getting me absolutely nowhere.
Running a 64bit windows OS (which is a work computer, and my particular windows login is not an administrator login.. so I make sure to open any exe files as administrator). I can't do anything in the terminal beyond "mongo" or "use [db name]".
I cannot save or add anything like db.testData.insert( j ). Even typing "show dbs", I get an error that says
listDatabases failed:{ "ok" :0, "errmsg" : "unauthorized" } at src/mongo/shell/mongo.js:46
With every example I've followed, I can never seem to be "authenticated" to get past point A. Please help me! I have no idea what I'm doing wrong at this point.
UPDATE:
Sorry for the confusion, everyone. The problem turned out to be that I had an old MongoDB service still running in the background that I needed to disable.
The service must have been turned on while I was testing out some node packages or something. Once I disabled the service, everything started working as expected.
So for those of you who are having trouble, make sure you open up services.msc and make sure nothing is running MongoDB
As there isn't a formal installer for Windows, I'd recommend you delete the data folder and restart. Out of the box, there is no security in MongoDb, so you've followed a step which later requires a password. Either retrace your steps, or start over.
You don't need to switch to the admin Database. I'd suggest you instead switch to a test database for example:
> use test
switched to db test
By default, without extra configuration, on Windows you can delete the contents of c:\data\db when MongoDb isn't running (but if you're using a configuration file that specifies the dbpath, delete the contents of that folder).
There are a number of tutorials with details of how to configure users/security with Mongodb that you may want to read after you've resolved this issue.
There's little reason to create users and administrative control with MongoDB until you gain some experience with the platform. In fact, I wouldn't recommend it at all. It just gets in the way as you're seeing for no real gain.

Resources