How to delete nested object from MongoDB collection

Sometimes, we write data into our mongodb collection by accident.

I can share interesting case that happened not so long ago.


So, this is what I can see in the database:






That’s why you should:

  1. Validate the id
  2. Or clean up the id




The code above will delete the xyz

Hope, this saves time for someone and will be useful.

So, the lesson is, always validate the inputs )

added ssl cert to my blog

Create local repository and push it to GitHub

First of all, you will need to create local repository.

Requirement: you should have git already installed. You can find more info here:

Go to the folder where your project is, then in terminal if you use Linux (0r Git Bash if you use Windows)

then type:

See if you have .gitignore file. If you have it then add folders which you want to exclude from appearing in your repository. If you don’t have it, then create it and add folders to ignore.

When you enter above command you might see message this message *** Please tell me who you are.

That means git doesn’t know particulars of the committer.

Then run this commands:

After that try committing again:

Now that git knows who we are, head to GitHub and create new repository(also skip adding README file, it’s too early too do so)


When you do this, you might face this error: hint: Updates were rejected because the remote contains work that you do
hint: not have locally.

That means remote repository has files that you don’t have locally. For example LICENSE file.

Then type:

This will allow you to get the remote files


Type your username and password

Now you if check your GitHub repository you can see that your files are there.

That’s it.

So whenever you do changes locally and want to commit them, just run these commands:

You might notice that every time you push your files, you need to enter your username and credentials. You can use below command to store your username and password. However, it will store your password somewhere on computer in plain text 🙂

then you will be asked to enter your username and password. After completing this you won’t be asked to do it again.





Initial CSS

It’s a good idea to custom set styles for the elements. However, elements are pre-set to certain puddings and margins . So it’s better to reset them. In your css file:

What are the options we used inside, you can see in my previous post.

CSS box model, Padding, Margin and Box-sizing

In css, all elements are placed in boxes. this is called box model.

Margin refers to the distance between the boxes.

Padding refers to the distance between the content and box edge.

By default, when we set the height and width of the element, the padding is also included. meaning if you have element like this:

the actual size will become 300px by 300px, because additional 100px is added to the content from each side. To prevent this, and set height and width such that padding and border is included, use