opposed to track the effectiveness of their own
existing campaigns.
2.2 Technology
2.2.1 System Technology
We chose the MEAN stack for the implementation of
the proposed system and in this section, we discuss
the how it is mostly a perfect fit for handeling
performance data-driven web services. The MEAN
stack is heavily focused around JavaScript and well
suited for data driven, responsive web applications.
Node.js brings JavaScript to server-side applications
and away from just being a client-side browser
language. Due to JavaScript operating with non-
blocking I/O it results in generally faster applications
that are easily scalable. MEAN is a relatively new
stack but is the go-to platform for most modern web
applications due to its seamlessly integrated layers,
passing data in JSON format from one to the other. It
keeps business logic and large computations to the
back-end server-side code and the Model-view-
controller (MVC) architecture on the front-end. It
comprises of the following layers:
MongoDB - is a NoSQL database that stores its data
in ‘collections’ of JSON formatted ‘documents’ as
opposed to ‘tables’ of ‘rows’. This often means that
the structure is in a more logical format and is less
restrictive.
Express - is a framework for Node.js with a wealth
of Hypertext Transfer Protocol (HTTP) functionality
making it perfect for building Representational State
Transfer (REST)ful application program interface
(API)s. It will be useful for processing requests from
the front-end client, and data sent from the GPS
tracking solution.
AngularJS - is a front-end MVC framework, great
for building powerful data driven Single Page
Applications - ideal for our data dashboard.
Node.js - is a platform that enables network
applications to be built with JavaScript on Google’s
V8 runtime engine. Node.js can be used for a variety
of different purposes, from background processes,
networking, all the way to building APIs.
The MEAN stack has its weaknesses and so in the
following section we cover where exactly the
technology may strike performance issues.
2.2.2 JavaScript
There are a number of distinguishing points that make
JavaScript a perfect fit. The features include non-
blocking IO, one single thread and its primary data
structure is JSON; each of which we define within
this section.
2.2.3 MongoDB
MongoDB is a noSQL (i.e. doesn’t use the common
query language - SQL), schema-less database that
stores its data in a binary representation of JavaScript
Object Notation (JSON), known as BSON. This is
great as it is the primary data structure used in
JavaScript (i.e. Node.js and Angular.js), and so there
is no need to parse any data as it’s returned from
database queries; thus speeding up the development
process and system performance. Being a document
and schema-less based database, it is structurally a lot
more flexible than table based databases such as
MySql. ‘Documents’ are stored in ‘collections’,
whereas in table based databases, ‘rows’ are stored in
‘tables’. As a result of this each document in the
database can take a different form than the next,
meaning that the system can conditionally add or
remove fields throughout its lifecycle. Each
document can comprise of nested documents,
meaning that there is no risk of ending up with a
database with multiple tables to cater for one-to-one
relationships.
Shema-less databases do however have their
drawbacks, if you are able to simply store any JSON
document in a collection it may end up with zero
coherence and as the database scales maintainability
will become a larger challenge. For this reason we
implement a Node.js middleware package called
Mongoose. Mongoose provides a foundation and all
the necessary tools for creating shema/models for
collections. It is a layer between managing data on the
server and the database. Every time a collection is
queried the Mongoose middleware will construct
objects with each of the database records using the
matched Schema. MongoDB also comes with a range
of useful query methods. Each query is made using a
JSON object and completes without blocking - thanks
to Node.js. MongoDB provides a powerful Geo
Query API that allows searching GeoSpatial indexes
relative to a given point or polygon. Queries can be
formed, for example, to search for all coordinates
within five kilometres of a given point, or to find all
points within a given polygon.
As a means of gathering data and querying based
on a matching set of results, MongoDB provides its
aggregation method. It allows you to query a
collection and produce a report of metrics on the
results of the query. As an example, if one wanted to
calculate the average age of males in the user base
stored in a database, an aggregation query can be