Mongo

Mongo

Prerequisites

  • The user must know how to connect to an Intel Edison and set up a wifi connection.

  • Basic Linus shell commands knowledge.

Mongo in Intel Edison

Instructions

  • First, set up a wifi connection using this command root@edison:~# configure_edison --wifi and following the on-screen instructions.

  • Run the commands below to add these repositories and update.

echo "src/gz all  http://repo.opkg.net/edison/repo/all" >> /etc/opkg/base-feeds.conf
echo "src/gz edison  http://repo.opkg.net/edison/repo/edison" >> /etc/opkg/base-feeds.conf
echo "src/gz core2-32  http://repo.opkg.net/edison/repo/core2-32" >> /etc/opkg/base-feeds.conf
opkg update
npm install -g express@4.12.3 express-generator mongoskin emailjs mraa    
npm install -g socket.io twilio socket.io-client exec-sync noble@0.3.9
npm install -g async@0.9.0 sleep
opkg install git

To install MongoDB, we need to download the package that contains it and unpackage it. First, create a Mongo directory and change directory to it, to maintain our process more centralized.

mkdir Mongo
cd Mongo

Download the tgz file with the following command

wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.6.8.tgz

create a binary folder and change to it, then unpack the file.

mkdir bin
cd bin
tar -xvzf ../mongodb-linux-i686-2.6.8.tgz
To verify the installation, type 

```sh
ls mongodb-linux-i686-2.6.8/

and we should see

GNU-AGPL-3.0  README  THIRD-PARTY-NOTICES  bin

Change directory to mongodb-linux-i686-2.6.8/bin with

cd mongodb-linux-i686-2.6.8/bin

Create a directory called data, this directory is where we are going to store all databases and collections that are created

mkdir data

Run

sh./m

ongod --dbpath data/

specifying the path to databases.

The daemon of mongo should be running by now, to send the process to the background in case we do not have another terminal, in your keyboard press ctrl + z.
Now, run 

```sh
./mongo

an instance of mongo should be runnning connected to a default database called test.

Mongo using Node.js

Gitbook on Frameworks/Node?

Status

  • mongo sucess

  • To do: Create a Gitbook on IoT Frameworks, Begin with Node to link Mongo and Node, create a restful api.

RESTful Service

  • To demonstrate how Mongo works, in this demo the user will create a simple restful web app with Node.js, Express and Mongo, to do in Node Gitbook and then replicate it here, same practice.

Last updated