Questions tagged [mongodb-shell]

The MongoDB shell is a command-line tool for querying and administering MongoDB.

The MongoDB shell is a command-line tool for MongoDB. It allows for querying collections, as well as admin functions like adding users, copying databases, and profiling.

Mongo Command Line

http://cheat.errtheblog.com/s/mongo

115 questions
0
votes
1 answer

mongoDB Shell Returning products who are 5% far from the minimum stock

I try to Return all the products who are 5% far from the minimum stock in mongoDB in the mongoDB product collation I have : _id, name, img, price, inStock _id: ObjectId("6523432dfsad123323g6h") name: air force img: "some URL" price: 250 inStock:…
George ak
  • 11
  • 3
0
votes
1 answer

Filtering MongoDB collections within collection using MongoDB Shell

Apologies for the nood question. I'm just starting out using MongoDB and MongoDB Shell. I've got a DB called Dealers that looks a little like this (very simplified): [ { "Id": 1, "Vehicles": [ { …
Strontium_99
  • 1,771
  • 6
  • 31
  • 52
0
votes
1 answer

Unable to configure mongoDB

Im learning mongoDB and exploring its features, i try several commands when i run the terminal and mongod acts like does not care. It always starts the server even though i simply run for reading help. Some commands that i run mongod --help mongod…
0
votes
2 answers

How to save deletion in a deeply nested MongoDB document

I am new to MongoDB and I am using MongoDB shell to perform the operations. I am working to remove the array named Process from all the Items, but it seems that I do not grasp the remove concept correctly. The documents we use are deeply nested - we…
0
votes
1 answer

Mongo DB Error while Updating - error on remote shard - caused by cursor id

I have about 8 Million Documents in my Collection. And I want to remove the special Characters in one of the fields. I will post my Statement below. I am using the mongo shell in the Mongo db compass tool. The update is working about 30-50 Minutes…
Swoop
  • 49
  • 1
  • 10
0
votes
0 answers

Mongo dbshell command history

I am trying to find the location of .dbshell storing, but I can't manage to find. May I know normally where does it storing? Environment: Docker mongo The server is installing in GCP, I am using debian server and run with ssh to manage the server.
0
votes
1 answer

How to updateMany many times within one function? MONGODB - Shell

As the question suggests, I have multiple columns which I would like to rename via shell. db.Hours.updateMany( {}, {"$rename" : {"season" : "Season"}}, ) db.Hours.updateMany( {}, {"$rename" :{"yr" : "Year"}} ) db.Hours.updateMany( {}, …
0
votes
1 answer

Error :couldn't connect to server 127.0.0.1:27017, connection attempt failed: NetworkTimeout Error connecting caused by Socket operation timed out

MongoDB shell version v4.4.6 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: NetworkTimeout: Error connecting to 127.0.0.1:27017…
0
votes
1 answer

How to connect MongoDB Shell with the external replicaset

As it can be seen from the screenshot that the MongoDB shell is connected to the localhost. I want to connect it with an external replica set like this(given below) for my study purpose. But could not do so. Please suggest a way…
0
votes
0 answers

I couldn't use mongod in the new M1 macbook, where each time I wrote it there are a bunch of codes appear in the terminal. What is the solution?

I have watched several videos on Youtube about this issue and none of them have worked. I know that I could not create mkdir -p /data/db because it will show me read-only due to Apple's system updates. You will find below what the terminal shows to…
0
votes
1 answer

unknown top level operator: $eq

Sample of my database: { name: 'The Perks of Being a Wallflower' genres: ['Drama', 'Romance'] rating: 8 }, { name: 'The Edge of Seventeen' genres: ['Drama', 'Comedy'] rating: 7.3 }, { name: 'Little Women', genres: ['Drama',…
Moaaz Bhnas
  • 1,010
  • 7
  • 18
  • 36
0
votes
1 answer

By using $cond to determine something, but why $cond is always true?

I was trying to find the total number of the document that does not contain both fields filed key and low. But it always returns true and the result is the total number of documents. it does exist such documents do not contain both fields. Here is…
Jay Park
  • 308
  • 1
  • 6
  • 14
0
votes
1 answer

MongoDB connection string - secondary node

How to ensure with a connection string that I always connect to secondary node? Is it even possible to force a connection to a secondary node with connection string?
Quijote
  • 113
  • 1
  • 2
  • 6
0
votes
0 answers

Unable to connect with mongo db shell

After running mongod and mongo in terminal $mongo MongoDB shell version v4.2.6 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("707b65a3-c675-4b03-a386-21c5d589c05f")…
bmnidhin
  • 56
  • 10
0
votes
1 answer

MongoDB collection toArray() length is 20 less than collection.count()

I am using mongoDB version 3.6.3 on a ubuntu operating system. I have created a collection with 100 records To manipulate the data on the mongo shell I assign cursor like below cur = db.dummyData.find({}, {_id: 0}) now the cur.count() is 100 but…
at07
  • 56
  • 5