Ɗ.

MongoDB logo

Mongo Things

Sharding

When your application receiving high rates of queries throughput or you are handling a large chunk of data which could be larger than the memory RAM itself then you have to think about scaling. Basically there are two type of scaling

Vertical Scaling

Means increasing the Memory, bandwidth of a single server. But it comes with cost and there is a practical maximum due to the hardware dependency.

Horizontal Scaling

Distributing the load over multiple machine is horizontal scaling but it comes with the complexity of managing multiple servers.

Now only listing terms and things to remember

Capped Collections

Cap some collection to store limited number of documents.You can also specify maxSize of document in collection.

$bucket operator in aggregation

{
  $bucket: {
    groupBy: <expression>,
    boundaries: [<boundary1>, ... ],
    default: <defaultBoundary>,
    output: {
      <field> : { <accumulator>: <expression> }
    }
  }
}

Transactions in mongo

  1. startSession
  2. startTransaction
  3. operations
  4. commitTransaction or abortTransaction
  5. endSession