Connecting to a Database
To track how many times the users click their blob and prevent them from clicking too frequently, you need a storage mechanism. As mentioned earlier, the mechanism used is the popular NoSQL database MongoDB.
Installing MongoDB on Windows
To install MongoDB you can download a recent version from its website at www.mongodb.org/downloads.
This is the recommended installation method for Windows. You need to download the correct version for the version of Windows you run, either 32 bit or 64 bit. After you have the file downloaded, unzip the folder to some location. (C:\Program Files\ is a good spot.) You probably want to rename the resulting folder from mongo-xxxxxxx (where xxxxxxx is the version number you downloaded) to just mongo.
When you have the folder downloaded, you need to create a data directory. Mongo uses the directory C:\data\db by default, but it won’t create those directories for you. Create the directories in Explorer or by launching the CMD terminal window and running the following:
C:\> mkdir \data
C:\> mkdir \data\db
After you create that folder, you can CD to the mongo\bin directory:
C:\> cd \Program Files\mongo\bin
From there you can run the mongod command to start the database server:
C:\Program Files\mongo> mongod
This launches the server. (You need to keep the window open.) For up-to-date installation instructions, see the Windows Quickstart tutorial on the Mongodb website at www.mongodb.org/display/DOCS/Quickstart+Windows.
You’ll probably ...
Get Professional HTML5 Mobile Game Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.