Questions tagged [mongodb]

MongoDB is a scalable, high-performance, open source, document-oriented NoSQL database. It supports a large number of languages and application development platforms. Questions about server administration can be asked on https://dba.stackexchange.com.

MongoDB is a widely used, general-purpose, document-oriented database with a multitude of features including replication for redundancy and high availability and sharding for horizontal scaling.

The MongoDB Community Edition database server and tools are source-available under Server Side Public License (all versions released after October 16, 2018) or open-source under AGPL v3.0 license (versions released prior to October 16, 2018). Commercial Licenses are also available from MongoDB, Inc.

MongoDB offers a powerful query language, MQL, and provides the Aggregation Framework and Map/Reduce for even more complex queries. MongoDB uses the BSON format for storing data and the MongoDB Wire Protocol for communication between client drivers and the MongoDB server. Officially supported Drivers and Client Libraries are available for most popular programming languages, and there are also Community Supported Drivers which offer alternative implementations and support for further programming languages.

The latest MongoDB server releases can be installed via common packaging systems or downloaded as binary archives from mongodb.com.

The current production release series of MongoDB is 6.0. It is generally recommended to stay current with the latest minor release of a production release series (e.g. 6.0.1) to take advantage of bug fixes and backward-compatible improvements. For more information on the versioning scheme used by the server, see MongoDB Version Numbers.

MongoDB has a GUI called MongoDB Compass, which is a powerful GUI for querying, aggregating, and analyzing your MongoDB data in a visual environment. Compass is free to use and source available and can be run on macOS, Windows, and Linux.

FAQ

MongoDB Community Forums are the official home for community discussion, product/driver announcements, and introductions.

For help with data modeling (schema design), check out the Data Models documentation page, the Building with Patterns blog series, and M320: Data Modeling course at MongoDB University.

For information on MongoDB Security, view the Security section of the MongoDB Manual which includes a MongoDB Security Checklist.

MongoDB, Inc. (the company behind MongoDB) provides archives of many presentations from their events such as conferences and webinars. They also develop a number of related tools and services including MongoDB Cloud Manager, MongoDB Ops Manager, MongoDB Atlas, and MongoDB Compass.

Useful links

Related Tags

Initial Release:

Feb 11, 2009

Latest Production Release Series:

6.0 (July 19, 2022 - Release notes)

Books

Articles

174599 questions
195
votes
25 answers

How to properly reuse connection to Mongodb across NodeJs application and modules

I've been reading and reading and still am confused on what is the best way to share the same database (MongoDb) connection across whole NodeJs app. As I understand connection should be open when app starts and reused between modules. My current…
spirytus
  • 10,726
  • 14
  • 61
  • 75
195
votes
7 answers

DynamoDB vs MongoDB NoSQL

I'm trying to figure out what can I use for a future project, we plan to store about 500k records per month in the first year and maybe more for the next years this is a vertical application so there's no need to use a database for this, that's the…
pedrommuller
  • 15,741
  • 10
  • 76
  • 126
194
votes
10 answers

mongodb: insert if not exists

Every day, I receive a stock of documents (an update). What I want to do is insert each item that does not already exist. I also want to keep track of the first time I inserted them, and the last time I saw them in an update. I don't want to have…
LeMiz
  • 5,554
  • 5
  • 28
  • 23
194
votes
16 answers

Populate nested array in mongoose

How can I populate "components" in the example document: { "__v": 1, "_id": "5252875356f64d6d28000001", "pages": [ { "__v": 1, "_id": "5252875a56f64d6d28000002", "page": { "components": [ …
Anton Shuvalov
  • 3,560
  • 3
  • 16
  • 20
194
votes
6 answers

What's the difference between findAndModify and update in MongoDB?

I'm a little bit confused by the findAndModify method in MongoDB. What's the advantage of it over the update method? For me, it seems that it just returns the item first and then updates it. But why do I need to return the item first? I read the…
chaonextdoor
  • 5,019
  • 15
  • 44
  • 61
193
votes
10 answers

Properly close mongoose's connection once you're done

I'm using mongoose in a script that is not meant to run continuously, and I'm facing what seems to be a very simple issue yet I can't find an answer; simply put once I make a call to any mongoose function that sends requests to mongodb my nodejs…
Lepidosteus
  • 11,779
  • 4
  • 39
  • 51
193
votes
28 answers

Unable to create/open lock file: /data/mongod.lock errno:13 Permission denied

How to I get mongo to use a mounted drive on ec2? I really do not understand. I attached a volume on ec2 formatted the drive as root and start as root and yet as root I cant access? I am running on ubuntu 12.04. No other mongo is running I see…
Tampa
  • 75,446
  • 119
  • 278
  • 425
190
votes
20 answers

How to stop mongo DB in one command

I need to be able to start/stop MongoDB on the cli. It is quite simple to start: ./mongod But to stop mongo DB, I need to run open mongo shell first and then type two commands: $ ./mongo use admin db.shutdownServer() So I don't know how to stop…
XiaoYao
  • 3,177
  • 4
  • 22
  • 19
189
votes
11 answers

What is a good choice of database for a small .NET application?

I'm developing a small application with C# in .NET and I want to have a small light weight database which does not use much resources. Could you please list some of the best known light weight database softwares.
ePezhman
  • 4,010
  • 7
  • 44
  • 80
188
votes
8 answers

How to update the _id of one MongoDB Document?

I want update an _id field of one document. I know it's not really good practice. But for some technical reason, I need to update it. If I try to update it I get: db.clients.update({ _id: ObjectId("123")}, { $set: { _id:…
shingara
  • 46,608
  • 11
  • 99
  • 105
187
votes
7 answers

How to use Elasticsearch with MongoDB?

I have gone through many blogs and sites about configuring Elasticsearch for MongoDB to index Collections in MongoDB but none of them were straightforward. Please explain to me a step by step process for installing elasticsearch, which should…
bibin david
  • 1,905
  • 3
  • 12
  • 8
187
votes
4 answers

mongodb group values by multiple fields

For example, I have these documents: { "addr": "address1", "book": "book1" }, { "addr": "address2", "book": "book1" }, { "addr": "address1", "book": "book5" }, { "addr": "address3", "book": "book9" }, { "addr": "address2", …
fervid
  • 2,033
  • 3
  • 13
  • 13
184
votes
16 answers

Reducing MongoDB database file size

I've got a MongoDB database that was once large (>3GB). Since then, documents have been deleted and I was expecting the size of the database files to decrease accordingly. But since MongoDB keeps allocated space, the files are still large. I read…
Meuble
  • 1,857
  • 2
  • 12
  • 3
183
votes
38 answers

'Field required a bean of type that could not be found.' error spring restful API using mongodb

So I've been learning Spring in the couples of week, been following this tutorial Building a RESTful Web Service All was well until I tried to integrate it to mongodb. So I follow this tutorial. Accessing Data with MongoDB But my practice is…
Eka Rudianto
  • 4,435
  • 4
  • 15
  • 23
183
votes
21 answers

How do I start Mongo DB from Windows?

I have installed MongoDB on my Windows 7 (64 bit) machine. I have created the path data/db too but when I tried to start mongodb using the command 'C:\mongodb\bin\mongod.exe', it is not starting. It is showing admin web console waiting for…
user3095838
  • 2,105
  • 3
  • 14
  • 6