mongo is not recognized as internal or external command - database

inspite of installing mongodb ,my mongo command showing that "mongo isn't recognizable as internal or external command"
though i have set the path variable mongod and mongosh is working but when I m trying to go for mongo then it hasn't happening

Related

i cant run mongo.exe from cmd

every time I run mongod.exe from cmd I get the following message on my screen
I'm a beginner in this so I really don't know what it means
I haven't seen anything on the web describing this
You have three questions.
Cannot run mongo.exe - See mongo.exe not installed in Version 6.0.0
Excessive output when you run mongod.exe
Install MongoDB as service. Create a configuration file (a default file should be created at C:\Program Files\MongoDB\Server\6.0\bin\mongod.cfg while installation) and create the service with
mongod.exe --install "C:\Program Files\MongoDB\Server\6.0\bin\mongod.cfg"
Then your MongoDB starts automatically at boot time.
I haven't seen anything describing the log format - See Log Messages

Can't use mongo shell on Windows and interact with MongoDB from command line [duplicate]

I installed MongoDB community Server from this link. But when I look into C:\Program Files\MongoDB\Server\6.0\bin
, I am not able to locate mongo.exe file. I am able to see mongod.exe and mongos.exe.
Can someone help. Thank you.
legacy mongo shell (mongo) no longer ships with server binaries (for servers >= 6.0). You can download a new shell version (mongosh) from here
Answer from dododo worked for me.
Download Mongo Shell - mongosh from MongoDB Download Center
Extract the contents of the bin from the downloaded zip file to the bin file of your MongoDB folder and run mongosh instead of mongo.
To run the Mongo Shell , Download msi package from the MongoDB Community Download - https://www.mongodb.com/try/download/community
The version 6.0 do not ships with server binaries so mongo.exe file wouldn't be shown. So instead download mongo shell - https://www.mongodb.com/try/download/shell
After downloading unzip the bin directory in your Original bin directory
(You would also need to create a new directory in C: drive named data/db)
Now open the bin directory from Mongodb folder, and run mongod.exe
After that keeping Mongod.exe running in background open mongosh.exe ,
Your mongo Shell will be started.
After version 6.0.0 mongo.exe does not get installed to your bin folder so you have to manually install the new MongoDB shell which is called mongosh then you have to add its path to your system variables and then run mongosh --version to see if it got installed. Afterwards if you want to create your own databases and preform operations run "mongosh" in your terminal to connect to a MongoDB instance running on your localhost with default port 27017.
Read the mongoDB documentation for more information:
install mongosh:
https://www.mongodb.com/docs/mongodb-shell/install/
The mongosh shell vs the old mongo shell:
https://www.mongodb.com/docs/mongodb-shell/
Connect to a Deployment:
https://www.mongodb.com/docs/mongodb-shell/connect/
It should be noted, that in MongoDB version 6.0 there are two items:
The legacy mongo shell is removed from MongoDB 6.0
The MongoDB Shell (mongosh) is not installed with MongoDB Server. You need to follow the mongosh installation instructions to download and install mongosh separately. This was already announced in MongoDB version 5.0
The legacy mongo shell does not exist anymore on MongoDB version 6.0. If you desire the old mongo.exe, then you can install if from an earlier MongoDB version.
You also need to add a path variable of the bin folder where mongosh application is present (after downloading from the below link:
https://www.mongodb.com/try/download/shell ).
Then you can use mongosh command from anywhere using CMD:
STEPS TO FOLLOW AFTER DOWNLOADING SHELL FROM https://www.mongodb.com/try/download/shell
Include both your mongosh shell and mongod in environment variables.
go to your c drive and create db folder inside data folder
then run your mongosh and mongod in two different cmd windows
separately
..first run mongod
..then run mongosh
if you have check-marked run as a service at the time of download
then next time you are not required to start mongosh , it will
automatically get started.

MongoDB server not starting up on local machine

I have been trying to start the mongodb server on my local machine but it is NOT working. It used to work earlier without any errors. I am using macOS Big Sur.
I typed the following in my terminal. I have my mongodb database files setup in mongodb-data folder.
sudo mongod --dbpath “/Users/userName/mongodb-data”
but this is giving error and exiting with an exit code of 100. I have made sure mongodb-data folder is present.
Here is a snippet from the error log:
"ctx":"initandlisten","msg":"DBException in initAndListen, terminating","attr":{"error":"NonExistentPath: Data directory “/Users/userName/mongodb-data” not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the 'storage.dbPath' option in the configuration file."}}
The only change I have made is to replace my name by userName for privacy.
Any suggestions?

AIP backup - using Docker

I am using the cloned dspace 6-x branch and installed it via docker. Can someone help me with the backup of my local database (Communities, collections, items)to a remote database?
According to the documentation we need to use the command:
dspace packager -s -t AIP -e eperson -p parent-handle file-path
But it returns an error: dspace is not a command
Anyone could help me transfer my local database to my remote repo?
Thanks!
Moving publications to a new repository will be a more substantial undertaking!
But your recent problem seems just that you are either not on the right container or in the right directory for executing the dspace command. Thus it is "not found". Make sure to execute dspace on the dspace container and specify the right/complete path. The dspace command is located in
/path/to/your/dspace-deployement-directory/bin.

MongoDB commands in linux console with --eval (print

I try run command mongo in linux console without entering into mongo shell.
To do it:
[root#router-mongos ~]# mongo --eval " printjson(show databases)"
But not run, this is the output:
MongoDB shell version: 2.6.10
connecting to: test
2015-06-10T18:33:39.834+0200 SyntaxError: Unexpected identifier
Though if you are uses:
[root#router-mongos ~]# mongo maria --eval " printjson (db.stats())"
o
mongo --eval " printjson(db.adminCommand('listDatabases'))"
Yes, the output is the same if you run it in shell.
Has anyone ever used this? can we help me? Thanks.
From the Mongo Shell documentation:
You cannot use any shell helper (e.g. use , show dbs, etc.) inside the JavaScript file because they are not valid JavaScript.
Following that, there is a table showing the JavaScript equivalents of the various shell helpers. From that, show dbs and show databases should be replaced by db.adminCommand('listDatabases') in your Mongo shell scripts.

Resources