Can't reinstall MongoDB on Ubuntu 17

I uninstalled before MongoDB but now I can't install it due to this error:

dpkg-deb: error: subprocess paste was killed by signal (Broken pipe).

I ran this command -> sudo apt-get install -y mongodb-org

My terminal output is following:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libboost-chrono1.62.0 libboost-program-options1.62.0 libgoogle-perftools4
libtcmalloc-minimal4 libunwind8 libyaml-cpp0.5v5 linux-headers-4.13.0-16
linux-headers-4.13.0-16-generic linux-headers-4.13.0-21
linux-headers-4.13.0-21-generic linux-image-4.13.0-16-generic
linux-image-4.13.0-21-generic linux-image-extra-4.13.0-16-generic
linux-image-extra-4.13.0-21-generic linux-signed-image-4.13.0-16-generic
linux-signed-image-4.13.0-21-generic mongo-tools
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
The following NEW packages will be installed:
mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell
mongodb-org-tools
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/66.8 MB of archives.
After this operation, 276 MB of additional disk space will be used.
Selecting previously unselected package mongodb-org-shell.
(Reading database ... 316734 files and directories currently installed.)
Preparing to unpack .../mongodb-org-shell_3.6.2_amd64.deb ...
Unpacking mongodb-org-shell (3.6.2) ...
Selecting previously unselected package mongodb-org-server.
Preparing to unpack .../mongodb-org-server_3.6.2_amd64.deb ...
Unpacking mongodb-org-server (3.6.2) ...
Selecting previously unselected package mongodb-org-mongos.
Preparing to unpack .../mongodb-org-mongos_3.6.2_amd64.deb ...
Unpacking mongodb-org-mongos (3.6.2) ...
Preparing to unpack .../mongodb-org-tools_3.6.2_amd64.deb ...
Unpacking mongodb-org-tools (3.6.2) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-tools_3.6.2_amd64.deb (--unpack):
trying to overwrite '/usr/bin/bsondump', which is also in package mongo-tools 3.2.11-1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Selecting previously unselected package mongodb-org.
Preparing to unpack .../mongodb-org_3.6.2_amd64.deb ...
Unpacking mongodb-org (3.6.2) ...
Errors were encountered while processing:
/var/cache/apt/archives/mongodb-org-tools_3.6.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

After running apt --fix-broken install, the output is as follows:

apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libboost-chrono1.62.0 libboost-program-options1.62.0 libgoogle-perftools4 libtcmalloc-minimal4 libunwind8 libyaml-cpp0.5v5 linux-headers-4.13.0-16
  linux-headers-4.13.0-16-generic linux-headers-4.13.0-21 linux-headers-4.13.0-21-generic linux-image-4.13.0-16-generic
  linux-image-4.13.0-21-generic linux-image-extra-4.13.0-16-generic linux-image-extra-4.13.0-21-generic linux-signed-image-4.13.0-16-generic
  linux-signed-image-4.13.0-21-generic mongo-tools
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  mongodb-org-tools
The following NEW packages will be installed:
  mongodb-org-tools
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
Need to get 0 B/34.9 MB of archives.
After this operation, 150 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 316761 files and directories currently installed.)
Preparing to unpack .../mongodb-org-tools_3.6.2_amd64.deb ...
Unpacking mongodb-org-tools (3.6.2) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-tools_3.6.2_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/bsondump', which is also in package mongo-tools 3.2.11-1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/mongodb-org-tools_3.6.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Solution 1:

You can force installation of package:

sudo dpkg -i --force-all /var/cache/apt/archives/mongodb-org-tools_3.6.2_amd64.deb

Then resume with:

sudo apt-get install -f