Mongo on Raspberry Pi 3 B+

pi@pineapple:~ $ sudo apt-get install mongodb
Setting up mongodb-clients (1:2.4.14-4) ...
Setting up libmongoclient-dev:armhf (1.1.2-5) ...
Setting up mongodb-dev (2:1.1.2-5) ...
Setting up mongodb-server (1:2.4.14-4) ...
Adding system user `mongodb' (UID 111) ...
Adding new user `mongodb' (UID 111) with group `nogroup' ...
Not creating home directory `/var/lib/mongodb'.
Adding group `mongodb' (GID 115) ...
Adding user `mongodb' to group `mongodb' ...
Adding user mongodb to group mongodb
Created symlink /etc/systemd/system/ → /lib/systemd/system/mongodb.service.
Setting up mongodb (1:2.4.14-4) ...
pi@pineapple:~ $ mongo
MongoDB shell version: 2.4.14
connecting to: test
Server has startup warnings:
Fri Nov 23 16:14:54.933 [initandlisten]
Fri Nov 23 16:14:54.933 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Fri Nov 23 16:14:54.934 [initandlisten] **       32 bit builds are limited to less than 2GB of data (or less with --journal).
Fri Nov 23 16:14:54.934 [initandlisten] **       See
Fri Nov 23 16:14:54.934 [initandlisten]
> db
> show dbs
local   0.03125GB
> use myNewDatabase
switched to db myNewDatabase
> db.myCollection.insert( { x: 1} );
> db.myCollection.find();
{ "_id" : ObjectId("5bf88e0a8d7e6c7adddc46de"), "x" : 1 }
> show dbs
local   0.03125GB
myNewDatabase   0.0625GB
> db.myCollection.insert( { name: "justin", age: 41, status: "cool", groups: [ "swimming", "computer science" ] } );
> k = { name: "heather", age: 39, status: "cool", groups: [ "zumba" ] }
    "name" : "heather",
    "age" : 39,
    "status" : "cool",
    "groups" : [
> db.myCollection.insert(k);
> db.myCollection.find();
{ "_id" : ObjectId("5bf88e0a8d7e6c7adddc46de"), "x" : 1 }
{ "_id" : ObjectId("5bf890188d7e6c7adddc46df"), "name" : "justin", "age" : 41, "status" : "cool", "groups" : [  "swimming",  "computer science" ] }
{ "_id" : ObjectId("5bf890578d7e6c7adddc46e0"), "name" : "heather", "age" : 39, "status" : "cool", "groups" : [  "zumba" ] }
> db.myCollection.remove( { "x" : 1 } );
> db.myCollection.find();
{ "_id" : ObjectId("5bf890188d7e6c7adddc46df"), "name" : "justin", "age" : 41, "status" : "cool", "groups" : [  "swimming",  "computer science" ] }
{ "_id" : ObjectId("5bf890578d7e6c7adddc46e0"), "name" : "heather", "age" : 39, "status" : "cool", "groups" : [  "zumba" ] }
> db.myCollection.update( { "name": "justin" }, { $set: { "age": 45 } } );
> db.myCollection.find( { "name": "justin" } );
{ "_id" : ObjectId("5bf890188d7e6c7adddc46df"), "name" : "justin", "age" : 45, "status" : "cool", "groups" : [  "swimming",  "computer science" ] }
> db.myCollection.update( { "name": "heather" }, { $set: { "age": 43 } } );
> db.myCollection.find( { "name": "heather" } );
{ "_id" : ObjectId("5bf890578d7e6c7adddc46e0"), "name" : "heather", "age" : 43, "status" : "cool", "groups" : [  "zumba" ] }

Getting started with Mongo


  • brew update && brew doctor
  • brew install mongodb
    [justin@Justins-MacBook-Pro:~/Dev/node]$ brew install mongodb
    ==> Installing mongodb dependency: scons
    ==> Downloading
    ######################################################################## 100.0%
    ==> /usr/bin/python install --prefix=/usr/local/Cellar/scons/2.3.4 --standalone
    🍺 /usr/local/Cellar/scons/2.3.4: 405 files, 4.4M, built in 16 seconds
    ==> Installing mongodb
    ==> Downloading
    ######################################################################## 100.0%
    ==> Patching
    patching file SConstruct
    patching file src/third_party/s2/util/endian/endian.h
    ==> /usr/local/opt/scons/bin/scons install --prefix=/usr/local/Cellar/mongodb/2.6.4_1 -j
    ==> Caveats
    To have launchd start mongodb at login:
    ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
    Then to load mongodb now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
    Or, if you don't want/need launchctl, you can just run:
    mongod --config /usr/local/etc/mongod.conf
    ==> Summary
    🍺 /usr/local/Cellar/mongodb/2.6.4_1: 17 files, 331M, built in 11.6 minutes

Running the server:

  • mongod –config /usr/local/etc/mongod.conf (use CTRL-C to exit)

Using the client:

  • `mongo`
  • Syntax is JavaScript, can declare and use functions on the fly
  • Useful commands:
    • help
    • db – shows current database
    • show collections – display the collections in the current database
  • To show databases:
    > show dbs
  • To create (as needed), and use a database
    > use mydb
  • To show collections in the current database:
    > show collections
  • Example to create a JSON document
    > j = { name: “justin”, age: 41, status: “cool”, groups: [ “swimming”, “computer science” ] }
    > k = { name: “heather”, age: 39, status: “cool”, groups: [ “zumba” ] }
  • Example to create collection in current database (as needed), and insert a document:
    > db.testData.insert(j)
    > db.testData.insert(k)
  • Example to query all documents in a collection:
    > db.testData.find()
  • Example to query for a specific document in a collection (in this case, documents with age > 40) and sort:
    > db.testData.find({age: {$gt: 40} }).sort({age: 1})


See also:

Node.js overview

The gist of Node.js.

  • Server-side JavaScript – runs the server and serves the content
  • Uses V8 Engine that powers Google Chrome
  • light-weight – not really a full web framework
  • Single-threaded
  • Designed for asynchronous processing (event-driven callbacks)
  • Great for IO-bound operations (database, file ops), bad for CPU-bound operations
  • Scaleable to large numbers of connections


Setting up SSH key authentication on Linux/Cygwin

On one of your machines:
$ ssh-keygen -t dsa (Don’t enter a passphrase unless you want to type it every time you want to use the key)
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/id_dsa
$ chmod 644 ~/.ssh/

On SSH server(s)
$ cat ~/.ssh/ >> ~/.ssh/authorized_keys2 (Or whatever public key you will accept)
$ chmod 600 ~/.ssh/authorized_keys2

To copy keys from one machine to another:
$ mkdir ~/.ssh (may not be necessary if it already exists)
$ chmod 700 ~/.ssh
$ scp <machine name>:.ssh/id_dsa* ~/.ssh

Greatness and the Divine Spark

I’m traveling home from a business trip to Washington, D.C. and I’ve just watched again one of my favorite videos – the documentation of Michael Phelps’ historic 8 gold medal wins at the Beijing Olympics in 2008.  As a swimmer, it is amazing and inspirational to watch.  It is an example of greatness, but I hope one that everyone can see in their own lives.  We can each have that kind of success in our own circumstances; and the kind of success that is no less meaningful to us than Phelps’ victory was to him. 

I’ve been a swimmer most all of my life – that is, I’ve loved to swim most all of my life.  Mom started me with lessons when I was just one year old (I’ll have to get a picture of that), and I remember taking swim lessons each summer throughout my life.  I remember being challenged one year when I was young because the culmination of a swim class was a mile-long swim.  I can still visually remember that day in my mind.  I can see the pool, the other swimmers, and I can remember what I was thinking.  I didn’t want to be the last one done, even though I was not among the fast swimmers in the class.  The swim seemed to take forever – lap after lap.  I was a competitive boy, so when someone stopped to rest on the wall, I remember being motivated to continue on without stopping.  I finished the mile in just under one hour, and I think I had one of the fastest times.

When I was maybe 12 years old, Mom suggested that I join a swim team.  So I went to try it out.  You had to wear a Speedo, which was exciting because it was a uniform identifying me as part of the team, but very small and it made me a little uncomfortable.  The swim team was Swim Utah Firewater (if I recall correctly) in Sandy, Utah.  I also visually remember the one and probably only workout I ever had with that team.  I hated it – just swimming back and forth for a whole hour?  That was no fun at all.  Additionally, I remember being among the slowest in the pool, and that was very discouraging.  That was it for swimming for several years.

When I was fourteen years old, my family moved from Sandy to Salt Lake City – about 30th South and 30th East.  It was the summer just before I would start Skyline High School as a sophomore.  I don’t remember why, but I joined the high school swim team.  It was great for me because I had an immediate set of new friends in the other swimmers of my lane.  Being older, the pool didn’t look so long, and the endless laps didn’t discourage me as much as they did when I was younger.  However, I was just a small kid – maybe 5 feet, 4 inches tall and 90 pounds or so.  And I was again the slowest person in the pool.  I didn’t give up, though – at that time, I think swimming was as much about the social experience as it was for the sporting experience.  But as the weeks went by, I wasn’t getting any better.

At the first parent-teacher conference that year, my parents met with my swim coach.  I know this because they told me about it later.  The coach said that I was a nice young man, but that he thought they needed to find me another sport.  This was understandable because at that time, Skyline was contending for the state championship in both the men’s and women’s swimming and diving.
However, being new at the school, my swim team friends were about all I had and I wasn’t going to give that up.  So I stayed on.  Additionally, the coach’s feedback motivated me to do my best so I would be better – maybe even swim in the state championships and contribute to our team’s score.  But it wasn’t happening that year.  Lane 1 was reserved for the fastest swimmers, and each lane was progressively slower – and I was still in the last lane – Lane 6.  But over the year, I moved up in the lane until I was among those who led the swimmers in the lane in each set.  At the end of the year, I cheered from the sidelines as the Skyline Men’s swim team won the Utah 5A state championships.

When the school year was over, I joined the USS swim team that swam there during the summer – so my training continued.  And I got better, but slowly.  During my Junior year, I improved slowly and was soon identified as a distance freestyle swimmer and was usually entered in the 200yd and 500 yd freestyle events in our dual meets.  By the end of the year, I had moved up to Lane 2.  This might sound amazing, but it didn’t reflect reality.  While I was able to keep up with the fast swimmers during workouts, my times in our meets was not improving proportionally.  I was still a very long way off from the state championships qualifying time of 5:40 in the 500 yard freestyle – the only event I figured I had a chance to qualify for.  However, by the end of the year I had done it. I still remember the time I swam 5:40 in a dual meet in the 500 yard freestyle and qualified for the state meet. But since only three swimmers from each team could swim each event at state – and I was not in our top three – I did not swim in the state championships that year. So I again worked out during the summer and by the beginning of my senior year, I was ready to swim with the folks in Lane 1.

Over the last two years, I had grown a few inches as I was then 5’9″ or so.  But I hadn’t gained too much weight – I was maybe 120 lbs.   But that didn’t seem to matter.  Many of the other boys that I swam against were smaller and shorter, but were still able to beat me badly without too much problem.  The workouts in Lane 1 were much more intense, and soon I was among those leading the sets in Lane 1.  But my meet times were still not reflecting it.  I was getting faster – I remember swimming a 5:36, then a 5:32, and then holding steady around 5:28.  That year, I was one of our top three swimmers in the 500 free – and also the 200 yard freestyle.  So I got to swim at state.

The state meet wasn’t terribly dramatic for me – other than my nerves.  (I still get nervous at swim meets when I go as part of a Masters’ team.)  In the morning I swam in the preliminaries – to determine the top 16 swimmers in each event that would qualify for the consolation and finals heats that evening.  I swam a 5:21 in the 500 freestyle in prelims and qualified for the consolation heat – and a chance at scoring – that evening.  I swam a 1:59 in the 200 freestyle, which did not qualify to move on.  That was ok with me – the 200 freestyle in my opinion is one of the hardest events in swimming, and those that were faster than me definitely earned it.

I remember a lot about the 500 freestyle consolation heat race that I swam that evening.  I especially remember swimming in an outside lane (as I had barely qualified) – and swimming a vigorous race against the guy swimming in the lane next to me.  When I touched the wall and looked up at the scoreboard, I finished the race in 5:17.03 and in fourth place.  After the finals heat, which was won by one of my good friends at Skyline – and who set a state record with the race, I had taken 12th place overall and had scored a point or two for my team.  It was definitely small beans for a team that was contending for the championship, but I had reached my goals and had contributed!  Later that summer, I took fourth place overall in the 1650 yard freestyle in the USS state championships, with a time of 18:32.

Over the course of three years, I went from slowest person in the pool to being able to place in the state championships and score points for my team.
It may sound like this is a bragging story, but it’s not intended to be that way.  What I learned was far more important than what I accomplished.  My accomplishment was every bit as significant and amazing for me as Michael Phelps’ victory was for him.  I had succeeded in a way that was a miracle.  And the more important lesson – it wasn’t because of me.  Sure, I worked very hard and did all that I could to achieve it, and in that way I enabled the miracle.  But the miracle occurred because of the spark of divinity which is in me.  It is the piece of us that we brought with us to Earth by virtue of our Heavenly parentage.  Each of us is a literal child of God – not just a creation, but a child – and as such, we have the innate ability to be great.  This manifests itself in different ways in each of us, as we are unique in the talents we have developed and in the challenges we choose to pursue.  But that spark of divinity glows brightly in each of us and is just waiting to be unlocked.

There will be those that disagree with me – and they certainly may.  However, I give myself as a witness to this fact and increase the ever-and -always-present evidence that we are children of God, come from Him and on our way to Him.  We limit ourselves only as we smother our Spark and refuse to develop and use it.  My swimming miracle is an example of how I used the Spark to develop myself.  I hasten to note that this is not the primary purpose of the Spark, but a preparation and a preliminary witness from God to me that it is real.  Our Divine Nature can only fully blossom from this Spark as we use it to facilitate and initiate miracles in the lives of others.
After all, that is what God is and does with his fully-developed Light of the Universe.  May this miracle come to pass for each of us.

Latest house pictures

House front
Here’s the front of the house
House back
.. and the back
Great room
The great room
Kitchen 1
One view of the kitchen
Kitchen 2
The other view of the kitchen
Entry way
The front entry
The office
The office
Great room looking upstairs
Great room looking upstairs
Master bedroom
Master bedroom
Girls bedroom
Girls' bedroom with the special green and purple paint!
Boys' bedroom
Boys' bedroom
Playroom loft
Playroom loft area
Spare bedroom
Spare bedroom/craft room