Mongo Shell By Example

Start the mongo shell

Start the mongo shell by running mongo

Note: this will connect using the default port 27017. Use -p for specifying a different port.

You should get an output similar to the following

MongoDB shell version v4.0.3
connecting to: mongodb://127.0.0.1:27017
Implicit session: session { "id" : UUID("2323-8as8-23aa-8fsa") }
MongoDB server version: 4.0.3
>

From this moment on, everything you’ll type will be executed in the mongo shell.

Continue reading “Mongo Shell By Example”

Python: Lists vs. Tuples

For Python beginners, the differences between lists and tuples might not be as clear as to those who already got some experience using them.

python

Let’s review the key differences between the two. hopefully, it will help you choose the right type in your code and understand that although this post called ‘lists vs. tuples’ there is no real match here. each type has his own use case.

Mutability

Mutability talks about the capability of an object to change or alter. This is one of the noticeable difference between the two types.

First, let’s use list:

>>> my_list = [1,2,3]
>>> my_list[2] = 9
>>> print my_list
[1, 2, 9]

Now let’s try the same on tuple:

Continue reading “Python: Lists vs. Tuples”