Skip to content

Instantly share code, notes, and snippets.

View robwilson1's full-sized avatar

Rob Wilson robwilson1

  • Filament AI
  • UK
View GitHub Profile

Storage Engines in MongoDB

  • v3.0 - introduced plugable storage engines (allowing switching of engines)
  • v3.2 - WiredTiger became default storage engine

The storage engine is directly responsible for Data file format and ithe format of indexes. Storage engine dos not affect the API that the programmer uses, nor does it have anything to do with inter server communication on replica sets.

MMAPv1

@robwilson1
robwilson1 / mongo_crud.md
Last active August 21, 2017 16:56
MongoDB Essentials

Reading Documents

Basics

db.colleciton.find({}) - Find all docs in collection

db.collection.find({}).pretty() - Pretty print all docs in collection

db.collection.find({}).count() - Return the number of docs in collection

@robwilson1
robwilson1 / lesson_7.md
Last active August 21, 2018 15:00
Async

Async and callbacks

When dealing with code, you often come across something about asyncronous and syncronous streams.

Imagine you go to McDonals and you order a Big Mac, in a syncronous world, no one else can place an order until your Big Mac has been cooked, bagged up and delivered to you. In an async world, when you order the Big Mac, the order is sent to some other people who cook it and bag it, whilst the guy who took your order can continue to serve other customers.

When dealing with JavaScript we often need to do things in order, to make it predictable and bug free. We also need to wait for something to happen before proceeding.

Callback functions

@robwilson1
robwilson1 / lesson_6.md
Last active August 21, 2018 15:00
Conditionals

Conditionals

As we have seen, everything in JavaScript will be either true or false, we can use this to direct the flow of our application.

    if (something is true) {
        // Do thing
    }
@robwilson1
robwilson1 / lesson_5.md
Last active August 21, 2018 15:00
Libraries

Libraries and Node

A library or a package is simply a collection of functions that someone has written and has made avaiable to the public either for free (open source) or by selling it. They may even be written by you!

Examples of libraries are:

  • jQuery - Helper functions for JavaScript in general
  • Express - A library for building a http server to host a website or webservice (API)
  • sequalize - A library that is used to allow a JavaScript application to directly manipuate an SQL databasse.
@robwilson1
robwilson1 / lesson_4.md
Created April 26, 2017 12:51
functions

Functions

In JavaScript, programs execute one line at a time from top to bottom.

Functions allow you to re-use bits of code to repeat a computation to return an output given 0 or more inputs.

Consider the following:

var a = 1;
@robwilson1
robwilson1 / lesson_3.md
Created April 26, 2017 12:38
Variables

Variables

A variable allows you to store some value in a easy to remember name so that you can retrive the stored value.

For instance if I wanted to make a program that dealt with money, then having a variable called 'balance' is easier than constantly writting out my current balance in numbers. This also gives us the advantage of updating the variable in one location, and having it update everywhere.

Consider the following:

// My balance is 10.00
@robwilson1
robwilson1 / lesson_2.md
Last active August 21, 2018 15:00
True False

Truthy and Falsey

Intro

In JavaScript things can either be true or false. Often we want to perform some code based on weather a condition is true or false.

	// Pretend code
	if TRUE do THIS
	otherwise do THAT
@robwilson1
robwilson1 / lesson_1.md
Last active August 21, 2018 14:59
Types

Types

Numbers

Numbers in JavaScript can be both positive, negative, whole numbers or floats.

Examples of a number:

  • 123
  • -47
  • 0