Questions tagged [mongodb]

All versions of MongoDB - a scalable, high-performance, open-source, document-oriented database.

MongoDB

MongoDB is a widely used, general-purpose, document-oriented NoSQL database with features including high-availability replication and auto-sharding for horizontal scaling. The MongoDB Community Edition database server and tools are open-sourced and available under Server Side Public License (all versions released after October 16, 2018) or AGPL v3.0 license (versions released prior to October 16, 2018). Commercial Licenses are also available from MongoDB, Inc.

MongoDB has strong support for dynamic querying and aggregating data including Map-Reduce and an Aggregation Framework. MongoDB uses BSON (Binary JSON) format for storage purposes and the MongoDB Wire Protocol for communication between client drivers and MongoDB deployments. 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.

Some relational-styled features

  • Secondary Indexes
  • Range Queries
  • Sorting

Some RDBMS terms and their MongoDB equivalent

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, Introduction to MongoDB and M320: Data Modeling at MongoDB University.

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 Atlas, MongoDB Cloud Manager, MongoDB Ops Manager, and MongoDB Compass.

Useful links

Books

2397 questions
127
votes
4 answers

Difference between Sharding And Replication on MongoDB

I am just confused about how Sharding and Replication work. According to the definitions I found in the documentation: Replication: A replica set in MongoDB is a group of mongod processes that maintain the same data set. Sharding: Sharding is a…
Saad Saadi
  • 1,401
  • 2
  • 10
  • 7
71
votes
6 answers

How restore a specific database from backup using mongorestore command

I created a backup of all my databases using mongodump command. Now I want to restore a specific database using mongorestore command. How is this possible, I use this command: --db option then mongodb doesn't restore a specific database.
pankaj choudhary
  • 841
  • 2
  • 8
  • 4
39
votes
4 answers

Difference between MongoDB's find and findone calls

I am working on a project and I am unsure if there is a difference between the way the find cursor works and the way the findOne cursor works. Is findOne just a wrapper for find().limit(1)? I was looking around for it and maybe someone knows if…
WojonsTech
  • 652
  • 1
  • 5
  • 11
37
votes
6 answers

How can I enter Mongo as a superuser or reset users?

I'm was playing around with permissions and locked myself out of Mongo database. I'm pretty sure I did this by trying to explicitly add access to a database but instead I overwrote only allowing permission to the database. So I'm effectively locked…
Tony
  • 579
  • 2
  • 5
  • 7
33
votes
1 answer

Sample YAML Configuration Files for MongoDB?

The MongoDB configuration options documentation lists all the available options that can be specified, but does anyone have a set of fully formed example YAML formatted config files for MongoDB instances in various roles? A set of examples for the…
Adam C
  • 9,235
  • 2
  • 27
  • 45
27
votes
1 answer

What happens if there are too many inserts in MongoDB? How to ensure all data is stored?

I use MongoDB to store periodically measured values. Every ~100 ms a bunch of values is inserted as document. It works fine, but I'm worried about performance issues. (I use safe inserts, it seems as if in PyMongo this is the default.) What happens…
lumbric
  • 373
  • 1
  • 3
  • 5
21
votes
3 answers

MongoDB: RAM requirements

Is it enough to have the entire index in memory/ram or does mongodb even try to allocate as much ram as possible to store even the data for fast reads? I'd like to run mongodb + other applications and it looks like mongodb is the only one which does…
ledy
  • 695
  • 3
  • 12
  • 16
13
votes
4 answers

Good Resources on Operating/Administering MongoDB

What are the best resources for learning how to operate and administer MongoDB? There are plenty of resources on developing against it - which actually creates a problem when you've got plenty of development competence and really need to filter out…
Rex M
  • 233
  • 1
  • 6
13
votes
1 answer

Is XFS still the best choice for mongodb?

There is this guide for production servers: https://docs.mongodb.com/manual/administration/production-notes/#kernel-and-file-systems It tells that for the WiredTiger storage engine, XFS is strongly recommended against ext3 or ext4. But that article…
nagylzs
  • 411
  • 1
  • 5
  • 16
13
votes
3 answers

How should I store time series in mongodb

I need to create a database of time series, and perform the following tasks: create new time series update existing time series query one or several time series at once (for instance all time series for the same date etc...) Is Mongo adapted to…
RockScience
  • 398
  • 2
  • 4
  • 13
12
votes
2 answers

Is sharding effective for small collections?

It looks like database sharding is great if I have huge collections. What if I have lots of fairly sized collections ? Let's say that for 1 collection of 100 000 000 documents (not very big comments) sharding is effective. Is it also effective for…
12
votes
1 answer

Why mongo is choosing the wrong index / execution plan?

In production mongod logfile, we can see a lot of slow queries. Most of them are not using the best index and consequently the best execution plan is not used. However, when I run the same queries by myself in mongo shell, the correct index is used.…
Sy10100
  • 335
  • 1
  • 2
  • 11
11
votes
2 answers

Mongo Collection `Size` is *larger* than `storageSize`?

I recently compacted my collection using the command: db..runCommand( "compact" ) And now my collection size seems to be bigger than size on disk! SECONDARY> db..stats() { "ns" :…
Chris W.
  • 591
  • 3
  • 6
  • 17
10
votes
4 answers

How to keep Mongodb log small via the conf file (or other persistent method)

This is related to my question in stackoverflow where vb.net simply hang on updating a mongodb query. https://stackoverflow.com/questions/12780258/insert-mongodb-using-vb-net/12796593#12796593 After long soul searching we check the log. The log is…
user4951
  • 1,355
  • 5
  • 20
  • 39
10
votes
1 answer

Mongo cannot find my collection

My mongodb server has a database named villageContents It has a collection named tablebusiness If I run mongo I saw MongoDB shell version: 2.0.7 connecting to: test > I wonder what "test" is. There is no database named test there. I tried to…
user4951
  • 1,355
  • 5
  • 20
  • 39
1
2 3
42 43