Tech Rescue
  • Home
  • Acronyms
  • Cheat-Sheets
  • User Manuals

MongoDB

How to solve `Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted` in MongoDB

Solution for `Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted` error n MongoDB and Linux.
Hector Perez Jun 26, 2023

How to configure a MongoDB replica set (local machine)

This post will guide you through the steps to set up a local replica set with two members and one arbiter. In a production environment the steps must be almost the same except that instead of starting three local MongoDB instances in different ports you would start an instance of
Hector Perez Oct 21, 2020

How to remove documents from a capped collection in MongoDB

You can’t remove one or all documents from a capped collection in MongoDB. BUT! you can drop the collection! Execute the following command: db.getCollection('myCollection').drop() The result for me is: true There you go, quick and easy. Sources: * https://docs.mongodb.com/manual/core/capped-collections/ * https://stackoverflow.
Hector Perez Mar 14, 2018

How to count documents of a collection in MongoDB

Today, I had to do this at work. turns out it is very easy. I am using Robomongo 1.0-RC1. I just double click on the collection that I want, in this case knives and I just execute the following query: db.getCollection('knives').count() The result in my case
Hector Perez Mar 13, 2018
Tech Rescue © 2025. Powered by Ghost