Before we start the implementation, just to highlight again
Topological sorting only works for DAG (directed acyclic graph) : a directed graph with no directed cycles
This helper function will assign topological number to a given vertex.
Finally, a driver function to trigger topological sorting.
Now each vertex is assigned with a number to form the topological sequence.
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.
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.
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.
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.
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 :
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…