Image for post
Image for post
Photo by Caspar Camille Rubin on Unsplash

What is package.json

package.json is a file holds various metadata relevant to the project. It is usually located at the root directory of a Node.js project.

This file will give information to npm for it to identify the project as well as handle the project’s dependencies.

It lists the packages your project depends on, specifies versions of a package to use, so it makes your build reproducible, and therefore easier to share with other developers.

Note package.json is used not only for dependencies management, its purpose is to give detail information about the project such as author, license, repository, scripts, …etc.

What is package-lock.json

package-lock.json is…

A typical monolithic server contains all of the codes implemented for all features for our application inside one codebase , and this server interact with a single database.

Image for post
Image for post

A microservice contains the codes needed for just one feature of our application.

Each service is self-contained and standalone, it interacts with its own database.

If one service crashes for some reason, other services are not impacted and still up and running, so a portion of our application is still working fine.

Now you have a MongoDB replica set and decide to downgrade it to a standalone node.

If you don’t have a replica set yet, please refer to my previous post Create a MongoDB replica set to create one to go through this article.

Remove secondary member nodes

Firstable, Shut down the mongod instance for the member you wish to remove.

Then connect to the replica set’s current primary instance.

Use rs.remove() to remove the secondary member :

Image for post
Image for post

Image for post
Image for post

A replica set in MongoDB is a group of mongod instances that maintain the same data set. It contains several data bearing nodes and optionally one arbiter node.

Of the data bearing nodes, one and only one member is deemed the primary node, while the other nodes are deemed secondary nodes.

The primary node receives all write operations and records all changes to its data sets in its operation log, i.e. oplog.

The secondaries replicate the primary’s oplog and apply the operations to their data sets asynchronously.

By having the secondaries’ data sets reflect the primary’s data set, the replica…

Adela Chao

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store