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.com/questions/33048282/how-to-remove-a-document-from-the-capped-collection

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 is: 1911 Hope it helps! Sources https://docs.mongodb.com/manual/reference/method/db.collection.count/

How to connect to a remote Oracle database

Here is how to connect to a remote Oracle database using SQLPlus: sqlplus user/pass@(DESCRIPTION=(ADDRESS=(PROTOCOL=protocol)(HOST=host)(PORT=port))(CONNECT_DATA=(SID=sid))) Please note that the words in Italics represent variables: user – user name for the remote database pass – password for the remote database protocol – protocol used to connect to remote database, usually TCP host – IP address or hostname of the remote host port – remote …

How to solve ORA-28001: The password has expired

The other day I was happily opening SQL Developer when I found this horrible thing. Here is how to solve it. Connect as sysdba to the database. C:UsersSiry>sqlplus / as sysdba Run the query to set the password’s life time to unlimited. SQL> ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; Profile altered. Set a password for the locked user. SQL> ALTER …

How to execute several .SQL files from console

Yesterday I needed to run an older version of a project just to make a few changes, for that I needed to update my old code for that project and run all the scripts (.SQL files) to update the database. A colleague gave me a line of code to get the task done faster than executing each file manually, here it is: …

How to grant access to remote PC in MySQL?

The problem we were facing was that a colleague was trying to access to a MySQL database in my computer, we were both in the same network, he was being asked for password, so for that, here is how to grant root access to another IP to your local database. This worked for us. GRANT ALL ON *.* to root@’10.101.60.142′ …