Questions tagged [mongo-shell]

The mongo shell is an interactive JavaScript shell for MongoDB, and is part of all MongoDB distributions. This section provides an introduction to the shell, and outlines key functions, operations, and use of the mongo shell.

Most examples in the MongoDB Manual use the mongo shell; however, many drivers provide similar interfaces to MongoDB.

FAQ

713 questions
-2
votes
2 answers

How to fix that type of error when I try to run command "mongod" for MongoDB

mongod {"t":{"$date":"2023-03-01T16:14:48.163+00:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"-","msg":"Initialized wire…
Sia
  • 7
  • 2
-2
votes
1 answer

How do I partially update a field in MongoDB so the new field will replace the old text to exisiting record

This is the field logo "https://image.s3.ca-central-1.amazonaws.com/prod/game/163221197…" "image.s3.ca-central-1.amazonaws.com" this part I want to change to "cloudfront.net" because I need to update all the logo from S3 to cloudfont.
-2
votes
1 answer

Mongo shell script - How to use libraries?

In a Mongo shell script I need to read a file to delete documents by _id but I can't import the FileReader library. I launch script from bash to do simple find() and it works: mongosh --host xxx --port 27017 --username xxx --password xxx --eval "var…
TomYJerry
  • 1
  • 2
-2
votes
1 answer

How to Export MongoDB Query Results to a File

I am running queries from mongo shell and get responses back on the screen. I want to get the response and store it to a file(text or js for example). For example: to store db.persons.find({}); to a persons.js file on current path on the terminal…
Moyshe Zuchmir
  • 1,522
  • 12
  • 18
-2
votes
1 answer

Group by mongo Shell

I have collection where each document has user related details. userid:1001,abc:1 userid:1001,abc:9 userid:1002,abc:1 userid:1001,abc:3 Something like this. I wanted to get count of userId which has maximum occurances. I need to do this on Mongo…
rl99
  • 501
  • 2
  • 5
  • 13
-3
votes
0 answers

immediate exit due to unhandled exception

PS C:\Windows\system32> mongod {"t":{"$date":"2023-08-30T20:40:03.611+05:30"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"thread1","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols…
Shivam
  • 1
  • 1
-3
votes
1 answer

Connect to remote Mongodb server on mongoshell

I started using mongoshell to connect to my remote mongodb using the following: connect (" connectionstring with username and login info") I saw this was method I saw on mongodb documentation used for windows mongoshell and wanted to confirm I was…
Josh
  • 105
  • 1
  • 5
-3
votes
1 answer

How to run a mongo query from java program?

The query that we run from a mongo-shell, I want to run the same query from a java program. How can I do that?
1 2 3
47
48