Sunday, September 22, 2019

MongoDB - Insert Document

Click the link: "MongoDB - Insert Document"

In this MongoDB tutorial we will learn to insert documents.

Insert one document

To insert one document into a collection we use the db.collection.insertOne() method.
Note! collection is the name of the collection in which you want to insert the document.
In the following example we are inserting one document into students collection.
> db.students.insertOne({
  "firstname": "Yusuf",
  "lastname": "Shakeel",
  "studentid": "s01"
On success we will get a similar response in the terminal.
  "acknowledged" : true,
  "insertedId" : ObjectId("5d16c693e8cb73839ac9f2ec")
Note! insertedId is a unique id (primary key) given to each document in a collection by MongoDB.
To fetch the inserted documents in a collection we use the find() method.
> db.students.find()
{ "_id" : ObjectId("5d16c693e8cb73839ac9f2ec"), "firstname" : "Yusuf", "lastname" : "Shakeel", "studentid" : "s01" }
We will learn more about find() in the Query Document tutorial.


Sunday, September 15, 2019

MongoDB - Database and Collection

Click the link: "MongoDB - Database and Collection"

In this MongoDB tutorial we will learn about databases, collections and documents.

What is a document?

A document is a key value pair. It is a JSON (JavaScript Object Notation).
Following example represents a student document.
  "student_id": "s0001",
  "first_name": "Yusuf",
  "last_name": "Shakeel"
student_idfirst_name and last_name are referred as the fields or keys of the document and s0001Yusuf and Shakeel are the respective values of the given fields.
If you are familiar with RDBMS (eg. MySQL) then a MongoDB document is like a row in a RDBMS table.

What is a collection?

A collection is a set of documents.
A single collection can have zero or more number of documents.
Think of MongoDB collections as tables in RDBMS.

Saturday, September 14, 2019

MongoDB - Getting Started

Click the link: "MongoDB - Getting Started"

This is the MongoDB getting started tutorial.

What is MongoDB?

MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era. No database is more productive to use.


If you have some prior knowledge of relational database (RDBMS like MySQL) then that is an advantage for you. Though MongoDB is not a RDBMS but having some database knowledge will help you understand MongoDB quickly.


Saturday, May 11, 2019

Find XOR of 1 to n

Find XOR of 1 to n


In this programming tutorial we will find XOR of 1 to n.

About XOR operator

XOR operator is a binary operator and it gives us 1 for odd number of 1s and 0 for even number of 1s.
In programming XOR is represented by ^ caret symbol.
We also represent XOR with this  plus inside circle symbol.
Following is the truth table for the XOR operator.
XOR of odd 1s = 1
XOR of even 1s = 0
Check out Boolean Algebra tutorial.
Let's solve the problem.
#programming #coding #xor #computer #tutorial #dyclassroom

Friday, May 10, 2019

Convert SRT to VTT

Subtitle Converter: SRT to VTT


What is SRT?

SubRip (SubRip Text) or SRT is a subtitle file format.

What is VTT?

VTT or WebVTT (Web Video Text Tracks) is a subtitle file format for the web. If you are using HTML5 video players on websites then you need .vtt file.

#subtitle #srt #vtt #video #movies #html5 #js #yusufshakeel


Finding nth Fibonacci number

Finding nth Fibonacci number


In this programming tutorial we will learn to solve Fibonacci series problems.

What is Fibonacci series?

Fibonacci series is a series of numbers (also known as Fibonacci number) such that any number is a sum of the two preceding numbers.
The first two numbers of the Fibonacci series are 1 and 1.
In the following example we have the first 10 Fibonacci numbers.
1, 1, 2, 3, 5, 8, 13, 21, 34 and 55.

#programming #coding #recursion #memoization #computer #tutorial #dyclassroom


Sunday, January 27, 2019

Best Sci-Fi movies on Amazon Prime - India

Best Sci-Fi movies on Amazon Prime - India


Some of the best and must watch science fiction (Sci-Fi) movies that are available on Amazon Prime in India.


The Matrix is a 1999 American science fiction movie directed by "The Wachowski Brothers".
The movie follows Neo a.k.a. Thomas Anderson (played by Keanu Reeves) who is a cybercriminal and hacker.

Neo discovers the reality humans perceive is a simulated reality called the Matrix created by a powerful thought-capable machine (artificial being).

To control the human population and get energy for itself the machine feds on the heat and electrical activity of the humans.
Neo joins a rebel group led by Morpheus (played by Laurence Fishburne) to stop the machine.
The movie won 4 Oscars at the 72nd Academy Awards ceremony in 2000.


#scifi #movies #entertainment #amazon #primevideo #blog #yusufshakeel