Make your development easier with version controlling and NoSQL

J.A.D Praveen Roshane De Silva
5 min readMar 17, 2022

There are many benefits of using a version control system for your projects. Because there are so many individuals in different places, there may be a need to communicate for a specific reason, or a group of people from different regions are working on the same project. The project has been completed in numerous versions storing all these commits in one place is a serious challenge in this case. Sometimes It may be necessary to revert to a previous version to find the root cause of bugs and knowing what modifications were made to prior versions of the source code or where the changes were made in a file is important. And another major problem is if the user’s system or disk fails and there is no backup all efforts will be for waste. For all these problems the perfect answer is the version controlling system.

The Version Control System enables international corporations to cooperate among their employees while also assisting in the creation of backups on a remote repository. If necessary, the system will allow developers to revert to older commits and the most recent version of the source code.

What Is Version Control?

Version Control is a system that tracks changes to a file or a series of files. The system belongs to a category of software tools that allow the development team to keep track of changes to the source code when necessary. The system keeps track of all modifications made to a file so that a specific version can be rolled back if needed in the future.

Advantages of version control are

  • Keeping Track of All the Modifications Made to the Code
  • Branching and merging
  • Managing and Protecting the Source Code
  • Traceability
  • Comparing Earlier Versions of the Code

Terminology

Repository: Central location where all the files are stored

Trunk: This is where the most stable code aka the production code kept

Stage: Mark files for tracking changes

Commit: created to capture the current state of a project

Branch: Copy of the master branch taken at a given point. All the feature developments and bug fixes will be done in a branch. Usually, it is allowed to have multiple branches at the same time

Checkout: Mark/unlock file for changing

Merge: Combining branches together to update the master branch

Merge conflict: Merge conflicts occur when merging a file which has been changed in two separate branches or places. Changes that interfere other changes

Best practices

· Always make sure to have the latest version of Trunk aka master branch

· Checkout only if necessary

· Merge the code at least once per day with the development branch

· Always make sure code is working properly before committing

There are many paid and free version control systems out of all these systems Git is the most popular one.

What is Git?

Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is faster compared to other systems and it supports both HTTP, SSH protocols.

Git commands

git init: Initializes a new Git repository

git add: Moves changes from the working directory to the staging area

git branch: create isolated development environments within a single repository

git checkout <branch>: navigate existing branches

git clean: Removes untracked files from the working directory

git clone: Creates a copy of an existing Git repository on local machine

git commit -m: Takes the staged snapshot and commits it to the project

git merge <branch>: Merge branch into the current branch

git pull: Downloads a branch from a remote repository, then immediately merges it into the local branch

git push: Push the branch to remote repository with necessary commits.

These are the fundamentals that you should be aware of before using Git for the first time. Now let’s move on to No SQL.

What is Database?

A database is a logically organized collection of structured data kept electronically in a computer system. Here we are only focusing on No SQL.

What does NoSQL mean?

NoSQL databases are commonly referred to as Non-relational databases. We can write a definition like this since NoSQL has a prescriptive meaning.

· Flexible schemas (mostly schema-less)

· Horizontally scalable

· Fast queries due to the data model

· Mostly open source

· Ease use of developers

CAP theorem

CAP theorem states that we can only achieve at most two out of three guarantees for a database:

· Consistency

· Availability

· Partition Tolerance

In here Consistency means that all nodes in the network see the same data at the same time. Availability ensures that each request receives a response indicating whether it was successful or unsuccessful. Partition Tolerance ensures that the system continues to function even if a message is lost, or a component of the system fails.

Types of NoSQL Databases

  • Column-oriented Graph: Store data in tables, rows, and dynamic columns that have many columns with an associated row key
  • Key-value Pair Based: Data is stored in key/value pairs. It is designed in such a way to handle lots of data and heavy load
  • Graphs based: Stores entities as well the relations amongst those entities.
  • Document-oriented: Data is retrieved as a key-value pair, but the value portion is saved as a document. JSON or XML formats are used to store the document.

MongoDB is the world’s most used NoSQL database application today. So let’s have a look at that.

What is MongoDB?

MongoDB is a document database that combines scalability and flexibility with the querying and indexing capabilities that you want. There are four types of queries in Mongo DB.

  • Insert
  • Find
  • Update
  • Delete

I strongly recommend studying the MongoDB docs. Because it has all of the necessary information and knowledge for manipulating NoSQL data in MongoDB.

https://docs.mongodb.com/

I hope this article has provided you with a basic understanding of version control and NoSQL.

--

--