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

2361 questions
126
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,381
  • 2
  • 9
  • 6
83
votes
5 answers

Which database could handle storage of billions/trillions of records?

We are looking at developing a tool to capture and analyze netflow data, of which we gather tremendous amounts of. Each day we capture about ~1.4 billion flow records which would look like this in json format: { "tcp_flags": "0", "src_as":…
somecallmemike
  • 945
  • 1
  • 7
  • 5
83
votes
4 answers

Mongodump: Unrecognized field 'snapshot'

I am using mongodump from mongo tools to download a backup of my server. However as I run the command, the command returns "Unrecognized field 'snapshot'". The full error is: Failed: error reading collection: Failed to parse: { find: "data", skip:…
Dave
  • 1,003
  • 2
  • 8
  • 8
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
45
votes
4 answers

Is it possible to install just the mongo Shell?

I have Docker installed and am running a MongoDB container for my local development on my Mac. The problem is that I can't connect to said DB easily from CLI. I have Robo 3T installed, but I would prefer to use the CLI client instead. Is there a…
CodeChimp
  • 553
  • 1
  • 4
  • 5
45
votes
3 answers

MongoDB using too much memory

We've been using MongoDB for several weeks now, the overall trend that we've seen has been that mongodb is using way too much memory (much more than the whole size of its dataset + indexes). I've already read through this question and this question,…
SpiXel
  • 911
  • 1
  • 9
  • 13
40
votes
3 answers

check storage engine from shell

I'm upgrading to 3.0 and ran into some issues with the upgrade. Specifically, I got an error when trying to start up mongod via ssh, it tried to use the default dbpath instead of the one I specified in my new YAML config file. I went ahead and…
ton.yeung
  • 503
  • 1
  • 4
  • 5
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
35
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
  • 559
  • 2
  • 5
  • 7
34
votes
1 answer

Mongodb incremental backups

I was given the task to set up incremental backups for MongoDB replicaset, as start point, of course, I googled it and could not find anything on MongoDB docs, I did find however this question on Stack Overflow, which encouraged to develop my own…
Tiago
  • 441
  • 1
  • 4
  • 3
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,175
  • 2
  • 26
  • 45
30
votes
2 answers

Using MongoDB and PostgreSQL together

My current project is essentially a run of the mill document management system. That said, there are some wrinkles (surprise, surprise). While some of the wrinkles are fairly specific to the project, I believe there are some general observations…
chucksmash
  • 535
  • 1
  • 6
  • 9
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
26
votes
3 answers

MongoDB MMAPv1 vs WiredTiger storage engines

In mongoDB3 appeared a new storage engine: WiredTiger. Yet, MMAPv1 is still the default choice in Mongo. One might not be better than the other, it's often a matter of use case and choosing the right tool for the job. But which engine is right for…
Buzut
  • 365
  • 1
  • 3
  • 9
25
votes
2 answers

Mongo Create a user as admin for any database raise an error

I am trying to create a simple user with the rights permission to access to any database and can do any actions. When I trying to execute the createUser command I got this error: db.createUser({ user: "mongoadmin" , pwd: "mongoadmin", roles:…
Robert
  • 635
  • 2
  • 12
  • 19
1
2 3
99 100