MongoDB Tutorial 2: Alternative control 2

 

MongoDB Plugin
UniServer 6-Carbo.

MongoDB

Introduction

MongoDB is a server in its own right and command line driven.

This page covers a set of pure (no PHP) batch files to run the server. I have made one concession and that is to include one of Uniform Server’s utilities to run server in the background.

Batch Files

Note the batch files are located in folder UniServer\usr\local\mongo\alt_control_2 along with Uniform Server's utility uniserv.exe

Start_mongo.bat

TITLE UNIFORM SERVER - Start MongoDB
COLOR B0
@echo off
cls
rem ###################################################
rem # Name: Start_mongo.bat
rem # Created By: The Uniform Server Development Team
rem # V 1.0 9-7-2010 Stop mongodb 
rem ##################################################

cd ..\bin
start ..\alt_control_2\uniserv.exe "mongod.exe -f config_no_auth.ini"

EXIT

Stop_mongo.bat

TITLE UNIFORM SERVER - Stop Mongo
COLOR B0
@echo off
cls
rem ###################################################
rem # Name: Start_UniTray.bat
rem # Created By: The Uniform Server Development Team
rem # V 1.0 9-7-2009 Starts UniTray 
rem ##################################################

cd ..\bin
start ..\alt_control_2\uniserv.exe "mongo.exe --eval \"db.getSisterDB('admin').shutdownServer()\""

EXIT

monogo_client.bat


TITLE UNIFORM SERVER - Mongo client
COLOR B0
@echo off
cls
rem ###################################################
rem # Name: mongo_client.bat
rem # Created By: The Uniform Server Development Team
rem # V 1.0 9-7-2009 Starts UniTray 
rem ##################################################

cd ..\bin
mongo.exe

pause

EXIT

run_cmd.bat

TITLE UNIFORM SERVER - Mongo client
COLOR B0
@echo off
cls
rem ###################################################
rem # Name: run_cmd.bat
rem # Created By: The Uniform Server Development Team
rem # V 1.0 9-7-2009 Starts UniTray 
rem ##################################################

cd ..\bin
cmd.exe /k "COLOR B0 && cls ";

EXIT


Top

Summary

Last page gave us a working server and confirmed functions are working as intended.

Although the batch files are a convenient way to run the server there is a fundamental flaw, lack of user feedback.

To resolve this issue remainder of this tutorial covers a small windows application. This provides user feedback and some extra features. Unlike the standalone version it integrates into Uniform Server's architecture adding new features.

This MongoDB application provides another good introduction to WinBinder. Next page looks at a basic windows application new template for this tutorial.


Top