http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/mongodb/lib/mongodb/collection.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/mongodb/lib/mongodb/collection.js 
b/web/demos/package/node_modules/mongodb/lib/mongodb/collection.js
deleted file mode 100644
index 448996b..0000000
--- a/web/demos/package/node_modules/mongodb/lib/mongodb/collection.js
+++ /dev/null
@@ -1,625 +0,0 @@
-/**
- * Module dependencies.
- * @ignore
- */
-var InsertCommand = require('./commands/insert_command').InsertCommand
-  , QueryCommand = require('./commands/query_command').QueryCommand
-  , DeleteCommand = require('./commands/delete_command').DeleteCommand
-  , UpdateCommand = require('./commands/update_command').UpdateCommand
-  , DbCommand = require('./commands/db_command').DbCommand
-  , ObjectID = require('bson').ObjectID
-  , Code = require('bson').Code
-  , Cursor = require('./cursor').Cursor
-  , utils = require('./utils')
-  , shared = require('./collection/shared')
-  , core = require('./collection/core')
-  , query = require('./collection/query')
-  , index = require('./collection/index')
-  , geo = require('./collection/geo')
-  , commands = require('./collection/commands')
-  , aggregation = require('./collection/aggregation');
-
-/**
- * Create a new Collection instance (INTERNAL TYPE, do not instantiate 
directly)
- *
- * Options
- *  - **readPreference** {String}, the prefered read preference 
(ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, 
ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, 
ReadPreference.NEAREST).
- *  - **slaveOk** {Boolean, default:false}, Allow reads from secondaries.
- *  - **serializeFunctions** {Boolean, default:false}, serialize functions on 
the document.
- *  - **raw** {Boolean, default:false}, perform all operations using raw bson 
objects.
- *  - **pkFactory** {Object}, object overriding the basic ObjectID primary key 
generation.
- *
- * @class Represents a Collection
- * @param {Object} db db instance.
- * @param {String} collectionName collection name.
- * @param {Object} [pkFactory] alternative primary key factory.
- * @param {Object} [options] additional options for the collection.
- * @return {Object} a collection instance.
- */
-function Collection (db, collectionName, pkFactory, options) {
-  if(!(this instanceof Collection)) return new Collection(db, collectionName, 
pkFactory, options);
-
-  shared.checkCollectionName(collectionName);
-
-  this.db = db;
-  this.collectionName = collectionName;
-  this.internalHint = null;
-  this.opts = options != null && ('object' === typeof options) ? options : {};
-  this.slaveOk = options == null || options.slaveOk == null ? db.slaveOk : 
options.slaveOk;
-  this.serializeFunctions = options == null || options.serializeFunctions == 
null ? db.serializeFunctions : options.serializeFunctions;
-  this.raw = options == null || options.raw == null ? db.raw : options.raw;
-
-  this.readPreference = options == null || options.readPreference == null ? 
db.serverConfig.options.readPreference : options.readPreference;
-  this.readPreference = this.readPreference == null ? 'primary' : 
this.readPreference;
-
-
-  this.pkFactory = pkFactory == null
-    ? ObjectID
-    : pkFactory;
-
-  // Server Capabilities
-  this.serverCapabilities = this.db.serverConfig._serverCapabilities;
-}
-
-/**
- * Inserts a single document or a an array of documents into MongoDB.
- *
- * Options
- *  - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern 
for the operation where < 1 is no acknowlegement of write and w >= 1, w = 
'majority' or tag acknowledges the write
- *  - **wtimeout**, {Number, 0} set the timeout for waiting for write concern 
to finish (combines with w option)
- *  - **fsync**, (Boolean, default:false) write waits for fsync before 
returning
- *  - **journal**, (Boolean, default:false) write waits for journal sync 
before returning
- *  - **continueOnError/keepGoing** {Boolean, default:false}, keep inserting 
documents even if one document has an error, *mongodb 1.9.1 >*.
- *  - **serializeFunctions** {Boolean, default:false}, serialize functions on 
the document.
- *  - **forceServerObjectId** {Boolean, default:false}, let server assign 
ObjectId instead of the driver
- *  - **checkKeys** {Boolean, default:true}, allows for disabling of document 
key checking (WARNING OPENS YOU UP TO INJECTION ATTACKS)
- *
- * Deprecated Options
- *  - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, 
executes with a getLastError command returning the results of the command on 
MongoDB.
- *
- * @param {Array|Object} docs
- * @param {Object} [options] optional options for insert command
- * @param {Function} [callback] optional callback for the function, must be 
provided when using a writeconcern
- * @return {null}
- * @api public
- */
-Collection.prototype.insert = function() { return core.insert; }();
-
-/**
- * Removes documents specified by `selector` from the db.
- *
- * Options
- *  - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern 
for the operation where < 1 is no acknowlegement of write and w >= 1, w = 
'majority' or tag acknowledges the write
- *  - **wtimeout**, {Number, 0} set the timeout for waiting for write concern 
to finish (combines with w option)
- *  - **fsync**, (Boolean, default:false) write waits for fsync before 
returning
- *  - **journal**, (Boolean, default:false) write waits for journal sync 
before returning
- *  - **single** {Boolean, default:false}, removes the first document found.
- * 
- * Deprecated Options 
- *  - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, 
executes with a getLastError command returning the results of the command on 
MongoDB.
- *
- * @param {Object} [selector] optional select, no selector is equivalent to 
removing all documents.
- * @param {Object} [options] additional options during remove.
- * @param {Function} [callback] must be provided if you performing a remove 
with a writeconcern
- * @return {null}
- * @api public
- */
-Collection.prototype.remove = function() { return core.remove; }();
-
-/**
- * Renames the collection.
- *
- * Options
- *  - **dropTarget** {Boolean, default:false}, drop the target name collection 
if it previously exists.
- *
- * @param {String} newName the new name of the collection.
- * @param {Object} [options] returns option results.
- * @param {Function} callback the callback accepting the result
- * @return {null}
- * @api public
- */
-Collection.prototype.rename = function() { return commands.rename; }();
-
-/**
- * Save a document. Simple full document replacement function. Not recommended 
for efficiency, use atomic
- * operators and update instead for more efficient operations.
- *
- * Options
- *  - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern 
for the operation where < 1 is no acknowlegement of write and w >= 1, w = 
'majority' or tag acknowledges the write
- *  - **wtimeout**, {Number, 0} set the timeout for waiting for write concern 
to finish (combines with w option)
- *  - **fsync**, (Boolean, default:false) write waits for fsync before 
returning
- *  - **journal**, (Boolean, default:false) write waits for journal sync 
before returning
- * 
- * Deprecated Options 
- *  - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, 
executes with a getLastError command returning the results of the command on 
MongoDB.
- *
- * @param {Object} [doc] the document to save
- * @param {Object} [options] additional options during remove.
- * @param {Function} [callback] must be provided if you performing a safe save
- * @return {null}
- * @api public
- */
-Collection.prototype.save = function() { return core.save; }();
-
-/**
- * Updates documents.
- *
- * Options
- *  - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern 
for the operation where < 1 is no acknowlegement of write and w >= 1, w = 
'majority' or tag acknowledges the write
- *  - **wtimeout**, {Number, 0} set the timeout for waiting for write concern 
to finish (combines with w option)
- *  - **fsync**, (Boolean, default:false) write waits for fsync before 
returning
- *  - **journal**, (Boolean, default:false) write waits for journal sync 
before returning
- *  - **upsert** {Boolean, default:false}, perform an upsert operation.
- *  - **multi** {Boolean, default:false}, update all documents matching the 
selector.
- *  - **serializeFunctions** {Boolean, default:false}, serialize functions on 
the document.
- *  - **checkKeys** {Boolean, default:true}, allows for disabling of document 
key checking (WARNING OPENS YOU UP TO INJECTION ATTACKS)
- *
- * Deprecated Options
- *  - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, 
executes with a getLastError command returning the results of the command on 
MongoDB.
- *
- * @param {Object} selector the query to select the document/documents to be 
updated
- * @param {Object} document the fields/vals to be updated, or in the case of 
an upsert operation, inserted.
- * @param {Object} [options] additional options during update.
- * @param {Function} [callback] must be provided if you performing an update 
with a writeconcern
- * @return {null}
- * @api public
- */
-Collection.prototype.update = function() { return core.update; }();
-
-/**
- * The distinct command returns returns a list of distinct values for the 
given key across a collection.
- *
- * Options
- *  - **readPreference** {String}, the preferred read preference, 
require('mongodb').ReadPreference (ReadPreference.PRIMARY, 
ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, 
ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
- *
- * @param {String} key key to run distinct against.
- * @param {Object} [query] option query to narrow the returned objects.
- * @param {Object} [options] additional options during update.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from distinct or 
null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.distinct = function() { return commands.distinct; }();
-
-/**
- * Count number of matching documents in the db to a query.
- *
- * Options
- *  - **skip** {Number}, The number of documents to skip for the count.
- *  - **limit** {Number}, The limit of documents to count.
- *  - **readPreference** {String}, the preferred read preference, 
require('mongodb').ReadPreference (ReadPreference.PRIMARY, 
ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, 
ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
- *
- * @param {Object} [query] query to filter by before performing count.
- * @param {Object} [options] additional options during count.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the count 
method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.count = function() { return commands.count; }();
-
-/**
- * Drop the collection
- *
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the drop 
method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.drop = function drop(callback) {
-  this.db.dropCollection(this.collectionName, callback);
-};
-
-/**
- * Find and update a document.
- *
- * Options
- *  - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern 
for the operation where < 1 is no acknowlegement of write and w >= 1, w = 
'majority' or tag acknowledges the write
- *  - **wtimeout**, {Number, 0} set the timeout for waiting for write concern 
to finish (combines with w option)
- *  - **fsync**, (Boolean, default:false) write waits for fsync before 
returning
- *  - **journal**, (Boolean, default:false) write waits for journal sync 
before returning
- *  - **remove** {Boolean, default:false}, set to true to remove the object 
before returning.
- *  - **upsert** {Boolean, default:false}, perform an upsert operation.
- *  - **new** {Boolean, default:false}, set to true if you want to return the 
modified object rather than the original. Ignored for remove.
- * 
- * Deprecated Options 
- *  - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, 
executes with a getLastError command returning the results of the command on 
MongoDB.
- *
- * @param {Object} query query object to locate the object to modify
- * @param {Array}  sort - if multiple docs match, choose the first one in the 
specified sort order as the object to manipulate
- * @param {Object} doc - the fields/vals to be updated
- * @param {Object} [options] additional options during update.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the 
findAndModify method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.findAndModify = function() { return core.findAndModify; 
}();
-
-/**
- * Find and remove a document
- *
- * Options
- *  - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern 
for the operation where < 1 is no acknowlegement of write and w >= 1, w = 
'majority' or tag acknowledges the write
- *  - **wtimeout**, {Number, 0} set the timeout for waiting for write concern 
to finish (combines with w option)
- *  - **fsync**, (Boolean, default:false) write waits for fsync before 
returning
- *  - **journal**, (Boolean, default:false) write waits for journal sync 
before returning
- * 
- * Deprecated Options 
- *  - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, 
executes with a getLastError command returning the results of the command on 
MongoDB.
- *
- * @param {Object} query query object to locate the object to modify
- * @param {Array}  sort - if multiple docs match, choose the first one in the 
specified sort order as the object to manipulate
- * @param {Object} [options] additional options during update.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the 
findAndRemove method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.findAndRemove = function() { return core.findAndRemove; 
}();
-
-/**
- * Creates a cursor for a query that can be used to iterate over results from 
MongoDB
- *
- * Various argument possibilities
- *  - callback?
- *  - selector, callback?,
- *  - selector, fields, callback?
- *  - selector, options, callback?
- *  - selector, fields, options, callback?
- *  - selector, fields, skip, limit, callback?
- *  - selector, fields, skip, limit, timeout, callback?
- *
- * Options
- *  - **limit** {Number, default:0}, sets the limit of documents returned in 
the query.
- *  - **sort** {Array | Object}, set to sort the documents coming back from 
the query. Array of indexes, [['a', 1]] etc.
- *  - **fields** {Object}, the fields to return in the query. Object of fields 
to include or exclude (not both), {'a':1}
- *  - **skip** {Number, default:0}, set to skip N documents ahead in your 
query (useful for pagination).
- *  - **hint** {Object}, tell the query to use specific indexes in the query. 
Object of indexes to use, {'_id':1}
- *  - **explain** {Boolean, default:false}, explain the query instead of 
returning the data.
- *  - **snapshot** {Boolean, default:false}, snapshot query.
- *  - **timeout** {Boolean, default:false}, specify if the cursor can timeout.
- *  - **tailable** {Boolean, default:false}, specify if the cursor is tailable.
- *  - **tailableRetryInterval** {Number, default:100}, specify the miliseconds 
between getMores on tailable cursor.
- *  - **numberOfRetries** {Number, default:5}, specify the number of times to 
retry the tailable cursor.
- *  - **awaitdata** {Boolean, default:false} allow the cursor to wait for 
data, only applicable for tailable cursor.
- *  - **oplogReplay** {Boolean, default:false} sets an internal flag, only 
applicable for tailable cursor.
- *  - **exhaust** {Boolean, default:false} have the server send all the 
documents at once as getMore packets, not recommended.
- *  - **batchSize** {Number, default:0}, set the batchSize for the 
getMoreCommand when iterating over the query results.
- *  - **returnKey** {Boolean, default:false}, only return the index key.
- *  - **maxScan** {Number}, Limit the number of items to scan.
- *  - **min** {Number}, Set index bounds.
- *  - **max** {Number}, Set index bounds.
- *  - **showDiskLoc** {Boolean, default:false}, Show disk location of results.
- *  - **comment** {String}, You can put a $comment field on a query to make 
looking in the profiler logs simpler.
- *  - **raw** {Boolean, default:false}, Return all BSON documents as Raw 
Buffer documents.
- *  - **readPreference** {String}, the preferred read preference, 
require('mongodb').ReadPreference ((ReadPreference.PRIMARY, 
ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, 
ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
- *  - **numberOfRetries** {Number, default:5}, if using awaidata specifies the 
number of times to retry on timeout.
- *  - **partial** {Boolean, default:false}, specify if the cursor should 
return partial results when querying against a sharded system
- *
- * @param {Object|ObjectID} query query object to locate the object to modify
- * @param {Object} [options] additional options during update.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the find 
method or null if an error occured.
- * @return {Cursor} returns a cursor to the query
- * @api public
- */
-Collection.prototype.find = function() { return query.find; }();
-
-/**
- * Finds a single document based on the query
- *
- * Various argument possibilities
- *  - callback?
- *  - selector, callback?,
- *  - selector, fields, callback?
- *  - selector, options, callback?
- *  - selector, fields, options, callback?
- *  - selector, fields, skip, limit, callback?
- *  - selector, fields, skip, limit, timeout, callback?
- *
- * Options
- *  - **limit** {Number, default:0}, sets the limit of documents returned in 
the query.
- *  - **sort** {Array | Object}, set to sort the documents coming back from 
the query. Array of indexes, [['a', 1]] etc.
- *  - **fields** {Object}, the fields to return in the query. Object of fields 
to include or exclude (not both), {'a':1}
- *  - **skip** {Number, default:0}, set to skip N documents ahead in your 
query (useful for pagination).
- *  - **hint** {Object}, tell the query to use specific indexes in the query. 
Object of indexes to use, {'_id':1}
- *  - **explain** {Boolean, default:false}, explain the query instead of 
returning the data.
- *  - **snapshot** {Boolean, default:false}, snapshot query.
- *  - **timeout** {Boolean, default:false}, specify if the cursor can timeout.
- *  - **tailable** {Boolean, default:false}, specify if the cursor is tailable.
- *  - **batchSize** {Number, default:0}, set the batchSize for the 
getMoreCommand when iterating over the query results.
- *  - **returnKey** {Boolean, default:false}, only return the index key.
- *  - **maxScan** {Number}, Limit the number of items to scan.
- *  - **min** {Number}, Set index bounds.
- *  - **max** {Number}, Set index bounds.
- *  - **showDiskLoc** {Boolean, default:false}, Show disk location of results.
- *  - **comment** {String}, You can put a $comment field on a query to make 
looking in the profiler logs simpler.
- *  - **raw** {Boolean, default:false}, Return all BSON documents as Raw 
Buffer documents.
- *  - **readPreference** {String}, the preferred read preference, 
require('mongodb').ReadPreference (ReadPreference.PRIMARY, 
ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, 
ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
- *  - **partial** {Boolean, default:false}, specify if the cursor should 
return partial results when querying against a sharded system
- *
- * @param {Object|ObjectID} query query object to locate the object to modify
- * @param {Object} [options] additional options during update.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the findOne 
method or null if an error occured.
- * @return {Cursor} returns a cursor to the query
- * @api public
- */
-Collection.prototype.findOne = function() { return query.findOne; }();
-
-/**
- * Creates an index on the collection.
- *
- * Options
- *  - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern 
for the operation where < 1 is no acknowlegement of write and w >= 1, w = 
'majority' or tag acknowledges the write
- *  - **wtimeout**, {Number, 0} set the timeout for waiting for write concern 
to finish (combines with w option)
- *  - **fsync**, (Boolean, default:false) write waits for fsync before 
returning
- *  - **journal**, (Boolean, default:false) write waits for journal sync 
before returning
- *  - **unique** {Boolean, default:false}, creates an unique index.
- *  - **sparse** {Boolean, default:false}, creates a sparse index.
- *  - **background** {Boolean, default:false}, creates the index in the 
background, yielding whenever possible.
- *  - **dropDups** {Boolean, default:false}, a unique index cannot be created 
on a key that has pre-existing duplicate values. If you would like to create 
the index anyway, keeping the first document the database indexes and deleting 
all subsequent documents that have duplicate value
- *  - **min** {Number}, for geospatial indexes set the lower bound for the 
co-ordinates.
- *  - **max** {Number}, for geospatial indexes set the high bound for the 
co-ordinates.
- *  - **v** {Number}, specify the format version of the indexes.
- *  - **expireAfterSeconds** {Number}, allows you to expire data on indexes 
applied to a data (MongoDB 2.2 or higher)
- *  - **name** {String}, override the autogenerated index name (useful if the 
resulting name is larger than 128 bytes)
- * 
- * Deprecated Options 
- *  - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, 
executes with a getLastError command returning the results of the command on 
MongoDB.
- *
- * @param {Object} fieldOrSpec fieldOrSpec that defines the index.
- * @param {Object} [options] additional options during update.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the 
createIndex method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.createIndex = function() { return index.createIndex; }();
-
-/**
- * Ensures that an index exists, if it does not it creates it
- *
- * Options
- *  - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern 
for the operation where < 1 is no acknowlegement of write and w >= 1, w = 
'majority' or tag acknowledges the write
- *  - **wtimeout**, {Number, 0} set the timeout for waiting for write concern 
to finish (combines with w option)
- *  - **fsync**, (Boolean, default:false) write waits for fsync before 
returning
- *  - **journal**, (Boolean, default:false) write waits for journal sync 
before returning
- *  - **unique** {Boolean, default:false}, creates an unique index.
- *  - **sparse** {Boolean, default:false}, creates a sparse index.
- *  - **background** {Boolean, default:false}, creates the index in the 
background, yielding whenever possible.
- *  - **dropDups** {Boolean, default:false}, a unique index cannot be created 
on a key that has pre-existing duplicate values. If you would like to create 
the index anyway, keeping the first document the database indexes and deleting 
all subsequent documents that have duplicate value
- *  - **min** {Number}, for geospatial indexes set the lower bound for the 
co-ordinates.
- *  - **max** {Number}, for geospatial indexes set the high bound for the 
co-ordinates.
- *  - **v** {Number}, specify the format version of the indexes.
- *  - **expireAfterSeconds** {Number}, allows you to expire data on indexes 
applied to a data (MongoDB 2.2 or higher)
- *  - **name** {String}, override the autogenerated index name (useful if the 
resulting name is larger than 128 bytes)
- * 
- * Deprecated Options 
- *  - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, 
executes with a getLastError command returning the results of the command on 
MongoDB.
- *
- * @param {Object} fieldOrSpec fieldOrSpec that defines the index.
- * @param {Object} [options] additional options during update.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the 
ensureIndex method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.ensureIndex = function() { return index.ensureIndex; }();
-
-/**
- * Retrieves this collections index info.
- *
- * Options
- *  - **full** {Boolean, default:false}, returns the full raw index 
information.
- *
- * @param {Object} [options] additional options during update.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the 
indexInformation method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.indexInformation = function() { return 
index.indexInformation; }();
-
-/**
- * Drops an index from this collection.
- *
- * @param {String} name
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the 
dropIndex method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.dropIndex = function dropIndex (name, callback) {
-  this.db.dropIndex(this.collectionName, name, callback);
-};
-
-/**
- * Drops all indexes from this collection.
- *
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the 
dropAllIndexes method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.dropAllIndexes = function() { return 
index.dropAllIndexes; }();
-
-/**
- * Drops all indexes from this collection.
- *
- * @deprecated
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the 
dropIndexes method or null if an error occured.
- * @return {null}
- * @api private
- */
-Collection.prototype.dropIndexes = function() { return 
Collection.prototype.dropAllIndexes; }();
-
-/**
- * Reindex all indexes on the collection
- * Warning: reIndex is a blocking operation (indexes are rebuilt in the 
foreground) and will be slow for large collections.
- *
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the reIndex 
method or null if an error occured.
- * @return {null}
- * @api public
-**/
-Collection.prototype.reIndex = function(callback) {
-  this.db.reIndex(this.collectionName, callback);
-}
-
-/**
- * Run Map Reduce across a collection. Be aware that the inline option for out 
will return an array of results not a collection.
- *
- * Options
- *  - **out** {Object}, sets the output target for the map reduce job. 
*{inline:1} | {replace:'collectionName'} | {merge:'collectionName'} | 
{reduce:'collectionName'}*
- *  - **query** {Object}, query filter object.
- *  - **sort** {Object}, sorts the input objects using this key. Useful for 
optimization, like sorting by the emit key for fewer reduces.
- *  - **limit** {Number}, number of objects to return from collection.
- *  - **keeptemp** {Boolean, default:false}, keep temporary data.
- *  - **finalize** {Function | String}, finalize function.
- *  - **scope** {Object}, can pass in variables that can be access from 
map/reduce/finalize.
- *  - **jsMode** {Boolean, default:false}, it is possible to make the 
execution stay in JS. Provided in MongoDB > 2.0.X.
- *  - **verbose** {Boolean, default:false}, provide statistics on job 
execution time.
- *  - **readPreference** {String, only for inline results}, the preferred read 
preference, require('mongodb').ReadPreference (ReadPreference.PRIMARY, 
ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, 
ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
- *
- * @param {Function|String} map the mapping function.
- * @param {Function|String} reduce the reduce function.
- * @param {Objects} [options] options for the map reduce job.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the 
mapReduce method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.mapReduce = function() { return aggregation.mapReduce; 
}();
-
-/**
- * Run a group command across a collection
- *
- * Options
- *  - **readPreference** {String}, the preferred read preference, 
require('mongodb').ReadPreference (ReadPreference.PRIMARY, 
ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, 
ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
- *
- * @param {Object|Array|Function|Code} keys an object, array or function 
expressing the keys to group by.
- * @param {Object} condition an optional condition that must be true for a row 
to be considered.
- * @param {Object} initial initial value of the aggregation counter object.
- * @param {Function|Code} reduce the reduce function aggregates (reduces) the 
objects iterated
- * @param {Function|Code} finalize an optional function to be run on each item 
in the result set just before the item is returned.
- * @param {Boolean} command specify if you wish to run using the internal 
group command or using eval, default is true.
- * @param {Object} [options] additional options during update.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the group 
method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.group = function() { return aggregation.group; }();
-
-/**
- * Returns the options of the collection.
- *
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the options 
method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.options = function() { return commands.options; }();
-
-/**
- * Returns if the collection is a capped collection
- *
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the 
isCapped method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.isCapped = function() { return commands.isCapped; }();
-
-/**
- * Checks if one or more indexes exist on the collection
- *
- * @param {String|Array} indexNames check if one or more indexes exist on the 
collection.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the 
indexExists method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.indexExists = function() { return index.indexExists; }();
-
-/**
- * Execute the geoNear command to search for items in the collection
- *
- * Options
- *  - **num** {Number}, max number of results to return.
- *  - **maxDistance** {Number}, include results up to maxDistance from the 
point.
- *  - **distanceMultiplier** {Number}, include a value to multiply the 
distances with allowing for range conversions.
- *  - **query** {Object}, filter the results by a query.
- *  - **spherical** {Boolean, default:false}, perform query using a spherical 
model.
- *  - **uniqueDocs** {Boolean, default:false}, the closest location in a 
document to the center of the search region will always be returned MongoDB > 
2.X.
- *  - **includeLocs** {Boolean, default:false}, include the location data 
fields in the top level of the results MongoDB > 2.X.
- *  - **readPreference** {String}, the preferred read preference, 
require('mongodb').ReadPreference ((ReadPreference.PRIMARY, 
ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, 
ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
- *
- * @param {Number} x point to search on the x axis, ensure the indexes are 
ordered in the same order.
- * @param {Number} y point to search on the y axis, ensure the indexes are 
ordered in the same order.
- * @param {Objects} [options] options for the map reduce job.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the geoNear 
method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.geoNear = function() { return geo.geoNear; }();
-
-/**
- * Execute a geo search using a geo haystack index on a collection.
- *
- * Options
- *  - **maxDistance** {Number}, include results up to maxDistance from the 
point.
- *  - **search** {Object}, filter the results by a query.
- *  - **limit** {Number}, max number of results to return.
- *  - **readPreference** {String}, the preferred read preference, 
require('mongodb').ReadPreference ((ReadPreference.PRIMARY, 
ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, 
ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
- *
- * @param {Number} x point to search on the x axis, ensure the indexes are 
ordered in the same order.
- * @param {Number} y point to search on the y axis, ensure the indexes are 
ordered in the same order.
- * @param {Objects} [options] options for the map reduce job.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the 
geoHaystackSearch method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.geoHaystackSearch = function() { return 
geo.geoHaystackSearch; }();
-
-/**
- * Retrieve all the indexes on the collection.
- *
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the indexes 
method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.indexes = function indexes(callback) {
-  this.db.indexInformation(this.collectionName, {full:true}, callback);
-}
-
-/**
- * Execute an aggregation framework pipeline against the collection, needs 
MongoDB >= 2.2
- *
- * Options
- *  - **readPreference** {String}, the preferred read preference, 
require('mongodb').ReadPreference ((ReadPreference.PRIMARY, 
ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, 
ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
- *
- * @param {Array} array containing all the aggregation framework commands for 
the execution.
- * @param {Object} [options] additional options during update.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the 
aggregate method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.aggregate = function() { return aggregation.aggregate; 
}();
-
-/**
- * Get all the collection statistics.
- *
- * Options
- *  - **scale** {Number}, divide the returned sizes by scale value.
- *  - **readPreference** {String}, the preferred read preference, 
require('mongodb').ReadPreference ((ReadPreference.PRIMARY, 
ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, 
ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
- *
- * @param {Objects} [options] options for the stats command.
- * @param {Function} callback this will be called after executing this method. 
The first parameter will contain the Error object if an error occured, or null 
otherwise. While the second parameter will contain the results from the stats 
method or null if an error occured.
- * @return {null}
- * @api public
- */
-Collection.prototype.stats = function() { return commands.stats; }();
-
-/**
- * @ignore
- */
-Object.defineProperty(Collection.prototype, "hint", {
-    enumerable: true
-  , get: function () {
-      return this.internalHint;
-    }
-  , set: function (v) {
-      this.internalHint = shared.normalizeHintField(v);
-    }
-});
-
-/**
- * Expose.
- */
-exports.Collection = Collection;

http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/mongodb/lib/mongodb/collection/aggregation.js
----------------------------------------------------------------------
diff --git 
a/web/demos/package/node_modules/mongodb/lib/mongodb/collection/aggregation.js 
b/web/demos/package/node_modules/mongodb/lib/mongodb/collection/aggregation.js
deleted file mode 100644
index e78e964..0000000
--- 
a/web/demos/package/node_modules/mongodb/lib/mongodb/collection/aggregation.js
+++ /dev/null
@@ -1,320 +0,0 @@
-var shared = require('./shared')
-  , utils = require('../utils')
-  , AggregationCursor = require('../aggregation_cursor').AggregationCursor
-  , Code = require('bson').Code  
-  , DbCommand = require('../commands/db_command').DbCommand;
-
-/**
- * Functions that are passed as scope args must
- * be converted to Code instances.
- * @ignore
- */
-function processScope (scope) {
-  if (!utils.isObject(scope)) {
-    return scope;
-  }
-
-  var keys = Object.keys(scope);
-  var i = keys.length;
-  var key;
-
-  while (i--) {
-    key = keys[i];
-    if ('function' == typeof scope[key]) {
-      scope[key] = new Code(String(scope[key]));
-    } else {
-      scope[key] = processScope(scope[key]);
-    }
-  }
-
-  return scope;
-}
-
-var pipe = function() {
-  return new AggregationCursor(this, this.serverCapabilities);
-}
-
-var mapReduce = function mapReduce (map, reduce, options, callback) {
-  if ('function' === typeof options) callback = options, options = {};
-  // Out must allways be defined (make sure we don't break weirdly on pre 1.8+ 
servers)
-  if(null == options.out) {
-    throw new Error("the out option parameter must be defined, see mongodb 
docs for possible values");
-  }
-
-  if ('function' === typeof map) {
-    map = map.toString();
-  }
-
-  if ('function' === typeof reduce) {
-    reduce = reduce.toString();
-  }
-
-  if ('function' === typeof options.finalize) {
-    options.finalize = options.finalize.toString();
-  }
-
-  var mapCommandHash = {
-      mapreduce: this.collectionName
-    , map: map
-    , reduce: reduce
-  };
-
-  // Add any other options passed in
-  for (var name in options) {
-    if ('scope' == name) {
-      mapCommandHash[name] = processScope(options[name]);
-    } else {
-      mapCommandHash[name] = options[name];
-    }
-  }
-
-  // Set read preference if we set one
-  var readPreference = shared._getReadConcern(this, options);
-
-  // If we have a read preference and inline is not set as output fail hard
-  if((readPreference != false && readPreference != 'primary') 
-    && options['out'] && (options['out'].inline != 1 && options['out'] != 
'inline')) {
-      readPreference = 'primary';    
-  }
-
-  // self
-  var self = this;
-  var cmd = DbCommand.createDbCommand(this.db, mapCommandHash);
-
-  this.db._executeQueryCommand(cmd, {read:readPreference}, function (err, 
result) {
-    if(err) return callback(err);
-    if(!result || !result.documents || result.documents.length == 0)
-      return callback(Error("command failed to return results"), null)
-
-    // Check if we have an error
-    if(1 != result.documents[0].ok || result.documents[0].err || 
result.documents[0].errmsg) {
-      return callback(utils.toError(result.documents[0]));
-    }
-
-    // Create statistics value
-    var stats = {};
-    if(result.documents[0].timeMillis) stats['processtime'] = 
result.documents[0].timeMillis;
-    if(result.documents[0].counts) stats['counts'] = 
result.documents[0].counts;
-    if(result.documents[0].timing) stats['timing'] = 
result.documents[0].timing;
-
-    // invoked with inline?
-    if(result.documents[0].results) {
-      // If we wish for no verbosity
-      if(options['verbose'] == null || !options['verbose']) {
-        return callback(null, result.documents[0].results);
-      }
-      return callback(null, result.documents[0].results, stats);
-    }
-
-    // The returned collection
-    var collection = null;
-
-    // If we have an object it's a different db
-    if(result.documents[0].result != null && typeof result.documents[0].result 
== 'object') {
-      var doc = result.documents[0].result;
-      collection = self.db.db(doc.db).collection(doc.collection);
-    } else {
-      // Create a collection object that wraps the result collection
-      collection = self.db.collection(result.documents[0].result)
-    }
-
-    // If we wish for no verbosity
-    if(options['verbose'] == null || !options['verbose']) {
-      return callback(err, collection);
-    }
-
-    // Return stats as third set of values
-    callback(err, collection, stats);
-  });
-};
-
-/**
- * Group function helper
- * @ignore
- */
-var groupFunction = function () {
-  var c = db[ns].find(condition);
-  var map = new Map();
-  var reduce_function = reduce;
-
-  while (c.hasNext()) {
-    var obj = c.next();
-    var key = {};
-
-    for (var i = 0, len = keys.length; i < len; ++i) {
-      var k = keys[i];
-      key[k] = obj[k];
-    }
-
-    var aggObj = map.get(key);
-
-    if (aggObj == null) {
-      var newObj = Object.extend({}, key);
-      aggObj = Object.extend(newObj, initial);
-      map.put(key, aggObj);
-    }
-
-    reduce_function(obj, aggObj);
-  }
-
-  return { "result": map.values() };
-}.toString();
-
-var group = function group(keys, condition, initial, reduce, finalize, 
command, options, callback) {
-  var args = Array.prototype.slice.call(arguments, 3);
-  callback = args.pop();
-  // Fetch all commands
-  reduce = args.length ? args.shift() : null;
-  finalize = args.length ? args.shift() : null;
-  command = args.length ? args.shift() : null;
-  options = args.length ? args.shift() || {} : {};
-
-  // Make sure we are backward compatible
-  if(!(typeof finalize == 'function')) {
-    command = finalize;
-    finalize = null;
-  }
-
-  if (!Array.isArray(keys) && keys instanceof Object && typeof(keys) !== 
'function' && !(keys instanceof Code)) {
-    keys = Object.keys(keys);
-  }
-
-  if(typeof reduce === 'function') {
-    reduce = reduce.toString();
-  }
-
-  if(typeof finalize === 'function') {
-    finalize = finalize.toString();
-  }
-
-  // Set up the command as default
-  command = command == null ? true : command;
-
-  // Execute using the command
-  if(command) {
-    var reduceFunction = reduce instanceof Code
-        ? reduce
-        : new Code(reduce);
-
-    var selector = {
-      group: {
-          'ns': this.collectionName
-        , '$reduce': reduceFunction
-        , 'cond': condition
-        , 'initial': initial
-        , 'out': "inline"
-      }
-    };
-
-    // if finalize is defined
-    if(finalize != null) selector.group['finalize'] = finalize;
-    // Set up group selector
-    if ('function' === typeof keys || keys instanceof Code) {
-      selector.group.$keyf = keys instanceof Code
-        ? keys
-        : new Code(keys);
-    } else {
-      var hash = {};
-      keys.forEach(function (key) {
-        hash[key] = 1;
-      });
-      selector.group.key = hash;
-    }
-
-    var cmd = DbCommand.createDbSlaveOkCommand(this.db, selector);
-    // Set read preference if we set one
-    var readPreference = shared._getReadConcern(this, options);
-    // Execute the command
-    this.db._executeQueryCommand(cmd
-      , {read:readPreference}
-      , utils.handleSingleCommandResultReturn(null, null, function(err, 
result) {
-        if(err) return callback(err, null);
-        callback(null, result.retval);
-      }));
-  } else {
-    // Create execution scope
-    var scope = reduce != null && reduce instanceof Code
-      ? reduce.scope
-      : {};
-
-    scope.ns = this.collectionName;
-    scope.keys = keys;
-    scope.condition = condition;
-    scope.initial = initial;
-
-    // Pass in the function text to execute within mongodb.
-    var groupfn = groupFunction.replace(/ reduce;/, reduce.toString() + ';');
-
-    this.db.eval(new Code(groupfn, scope), function (err, results) {
-      if (err) return callback(err, null);
-      callback(null, results.result || results);
-    });
-  }
-};
-
-var aggregate = function(pipeline, options, callback) {
-  var args = Array.prototype.slice.call(arguments, 0);
-  callback = args.pop();
-  var self = this;
-
-  // If we have any of the supported options in the options object
-  var opts = args[args.length - 1];
-  options = opts.readPreference 
-    || opts.explain 
-    || opts.cursor 
-    || opts.out
-    || opts.allowDiskUsage ? args.pop() : {}
-  // If the callback is the option (as for cursor override it)
-  if(typeof callback == 'object' && callback != null) options = callback;
-
-  // Convert operations to an array
-  if(!Array.isArray(args[0])) {
-    pipeline = [];
-    // Push all the operations to the pipeline
-    for(var i = 0; i < args.length; i++) pipeline.push(args[i]);
-  }
-
-  // Is the user requesting a cursor
-  if(options.cursor != null && options.out == null) {
-    // Set the aggregation cursor options
-    var agg_cursor_options = options.cursor;
-    agg_cursor_options.pipe = pipeline;
-    agg_cursor_options.allowDiskUsage = options.allowDiskUsage == null ? false 
: options.allowDiskUsage;
-    // Return the aggregation cursor
-    return new AggregationCursor(this, this.serverCapabilities, 
agg_cursor_options);
-  }
-
-  // If out was specified
-  if(typeof options.out == 'string') {
-    pipeline.push({$out: options.out});
-  }
-
-  // Build the command
-  var command = { aggregate : this.collectionName, pipeline : pipeline};
-  // If we have allowDiskUsage defined
-  if(options.allowDiskUsage) command.allowDiskUsage = options.allowDiskUsage;
-
-  // Ensure we have the right read preference inheritance
-  options.readPreference = shared._getReadConcern(this, options);
-  // If explain has been specified add it
-  if(options.explain) command.explain = options.explain;
-  // Execute the command
-  this.db.command(command, options, function(err, result) {
-    if(err) {
-      callback(err);
-    } else if(result['err'] || result['errmsg']) {
-      callback(utils.toError(result));
-    } else if(typeof result == 'object' && result['serverPipeline']) {
-      callback(null, result['serverPipeline']);
-    } else if(typeof result == 'object' && result['stages']) {
-      callback(null, result['stages']);
-    } else {
-      callback(null, result.result);
-    }
-  });
-}
-
-exports.mapReduce = mapReduce;
-exports.group = group;
-exports.aggregate = aggregate;
-exports.pipe = pipe;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/mongodb/lib/mongodb/collection/commands.js
----------------------------------------------------------------------
diff --git 
a/web/demos/package/node_modules/mongodb/lib/mongodb/collection/commands.js 
b/web/demos/package/node_modules/mongodb/lib/mongodb/collection/commands.js
deleted file mode 100644
index 046f009..0000000
--- a/web/demos/package/node_modules/mongodb/lib/mongodb/collection/commands.js
+++ /dev/null
@@ -1,136 +0,0 @@
-var shared = require('./shared')
-  , utils = require('../utils')
-  , DbCommand = require('../commands/db_command').DbCommand;
-
-var stats = function stats(options, callback) {
-  var args = Array.prototype.slice.call(arguments, 0);
-  callback = args.pop();
-  // Fetch all commands
-  options = args.length ? args.shift() || {} : {};
-
-  // Build command object
-  var commandObject = {
-    collStats:this.collectionName,
-  }
-
-  // Check if we have the scale value
-  if(options['scale'] != null) commandObject['scale'] = options['scale'];
-
-  // Ensure we have the right read preference inheritance
-  options.readPreference = shared._getReadConcern(this, options);
-
-  // Execute the command
-  this.db.command(commandObject, options, callback);
-}
-
-var count = function count(query, options, callback) {
-  var args = Array.prototype.slice.call(arguments, 0);
-  callback = args.pop();
-  query = args.length ? args.shift() || {} : {};
-  options = args.length ? args.shift() || {} : {};
-  var skip = options.skip;
-  var limit = options.limit;
-  var maxTimeMS = options.maxTimeMS;
-
-  // Final query
-  var commandObject = {
-      'count': this.collectionName
-    , 'query': query
-    , 'fields': null
-  };
-
-  // Add limit and skip if defined
-  if(typeof skip == 'number') commandObject.skip = skip;
-  if(typeof limit == 'number') commandObject.limit = limit;
-  if(typeof maxTimeMS == 'number') commandObject['$maxTimeMS'] = maxTimeMS;
-
-  // Set read preference if we set one
-  var readPreference = shared._getReadConcern(this, options);
-  // Execute the command
-  this.db._executeQueryCommand(DbCommand.createDbSlaveOkCommand(this.db, 
commandObject)
-    , {read: readPreference}
-    , utils.handleSingleCommandResultReturn(null, null, function(err, result) {
-      if(err) return callback(err, null);
-      if(result == null) return callback(new Error("no result returned for 
count"), null);
-      callback(null, result.n);
-    }));
-};
-
-var distinct = function distinct(key, query, options, callback) {
-  var args = Array.prototype.slice.call(arguments, 1);
-  callback = args.pop();
-  query = args.length ? args.shift() || {} : {};
-  options = args.length ? args.shift() || {} : {};
-
-  var mapCommandHash = {
-      'distinct': this.collectionName
-    , 'query': query
-    , 'key': key
-  };
-
-  // Set read preference if we set one
-  var readPreference = options['readPreference'] ? options['readPreference'] : 
false;
-  // Create the command
-  var cmd = DbCommand.createDbSlaveOkCommand(this.db, mapCommandHash);
-
-  this.db._executeQueryCommand(cmd, {read:readPreference}, function (err, 
result) {
-    if(err)
-      return callback(err);
-    if(result.documents[0].ok != 1)
-      return callback(new Error(result.documents[0].errmsg));
-    callback(null, result.documents[0].values);
-  });
-};
-
-var rename = function rename (newName, options, callback) {
-  var self = this;
-  if(typeof options == 'function') {
-    callback = options;
-    options = {}
-  }
-
-  // Get collection class
-  var Collection = require('../collection').Collection;
-  // Ensure the new name is valid
-  shared.checkCollectionName(newName);
-  
-  // Execute the command, return the new renamed collection if successful
-  
self.db._executeQueryCommand(DbCommand.createRenameCollectionCommand(self.db, 
self.collectionName, newName, options)
-    , utils.handleSingleCommandResultReturn(true, false, function(err, result) 
{
-      if(err) return callback(err, null)
-      try {
-        if(options.new_collection)
-          return callback(null, new Collection(self.db, newName, 
self.db.pkFactory));
-        self.collectionName = newName;
-        callback(null, self);
-      } catch(err) {
-        callback(err, null);
-      }
-    }));
-};
-
-var options = function options(callback) {
-  this.db.collectionsInfo(this.collectionName, function (err, cursor) {
-    if (err) return callback(err);
-    cursor.nextObject(function (err, document) {
-      callback(err, document && document.options || null);
-    });
-  });
-};
-
-var isCapped = function isCapped(callback) {
-  this.options(function(err, document) {
-    if(err != null) {
-      callback(err);
-    } else {
-      callback(null, document && document.capped);
-    }
-  });
-};
-
-exports.stats = stats;
-exports.count = count;
-exports.distinct = distinct;
-exports.rename = rename;
-exports.options = options;
-exports.isCapped = isCapped;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/mongodb/lib/mongodb/collection/core.js
----------------------------------------------------------------------
diff --git 
a/web/demos/package/node_modules/mongodb/lib/mongodb/collection/core.js 
b/web/demos/package/node_modules/mongodb/lib/mongodb/collection/core.js
deleted file mode 100644
index 208506e..0000000
--- a/web/demos/package/node_modules/mongodb/lib/mongodb/collection/core.js
+++ /dev/null
@@ -1,727 +0,0 @@
-var InsertCommand = require('../commands/insert_command').InsertCommand
-  , DeleteCommand = require('../commands/delete_command').DeleteCommand
-  , UpdateCommand = require('../commands/update_command').UpdateCommand
-  , DbCommand = require('../commands/db_command').DbCommand
-  , utils = require('../utils')
-  , hasWriteCommands = require('../utils').hasWriteCommands
-  , shared = require('./shared');
-
-/**
- * Precompiled regexes
- * @ignore
- **/
-var eErrorMessages = /No matching object found/;
-
-// ***************************************************
-// Insert function
-// ***************************************************
-var insert = function insert (docs, options, callback) {
-  if ('function' === typeof options) callback = options, options = {};
-  if(options == null) options = {};
-  if(!('function' === typeof callback)) callback = null;
-
-  // Get a connection
-  var connection = this.db.serverConfig.checkoutWriter();
-  var useLegacyOps = options.useLegacyOps == null || options.useLegacyOps == 
false ? false : true;
-  // If we support write commands let's perform the insert using it  
-  if(!useLegacyOps && hasWriteCommands(connection) 
-    && !Buffer.isBuffer(docs) 
-    && (!Array.isArray(docs) && docs.length > 0 && !Buffer.isBuffer(docs[0]))) 
{
-      insertWithWriteCommands(this, Array.isArray(docs) ? docs : [docs], 
options, callback);
-      return this
-  } 
-
-  // Backwards compatibility
-  insertAll(this, Array.isArray(docs) ? docs : [docs], options, callback);
-  return this;
-};
-
-//
-// Uses the new write commands available from 2.6 >
-//
-var insertWithWriteCommands = function(self, docs, options, callback) {
-  // Get the intended namespace for the operation
-  var namespace = self.collectionName;
-
-  // Ensure we have no \x00 bytes in the name causing wrong parsing
-  if(!!~namespace.indexOf("\x00")) {
-    return callback(new Error("namespace cannot contain a null character"), 
null);
-  }
-
-  // Check if we have passed in continue on error
-  var continueOnError = typeof options['keepGoing'] == 'boolean' 
-    ? options['keepGoing'] : false;
-  continueOnError = typeof options['continueOnError'] == 'boolean' 
-    ? options['continueOnError'] : continueOnError;
-
-  // Do we serialzie functions
-  var serializeFunctions = typeof options.serializeFunctions != 'boolean' 
-    ? self.serializeFunctions : options.serializeFunctions;
-
-  // Checkout a write connection
-  var connection = self.db.serverConfig.checkoutWriter();  
-
-  // Collect errorOptions
-  var errorOptions = shared._getWriteConcern(self, options);
-
-  // If we have a write command with no callback and w:0 fail
-  if(errorOptions.w && errorOptions.w != 0 && callback == null) {
-    throw new Error("writeConcern requires callback")
-  }
-
-  // Add the documents and decorate them with id's if they have none
-  for(var index = 0, len = docs.length; index < len; ++index) {
-    var doc = docs[index];
-
-    // Add id to each document if it's not already defined
-    if (!(Buffer.isBuffer(doc))
-      && doc['_id'] == null
-      && self.db.forceServerObjectId != true
-      && options.forceServerObjectId != true) {
-        doc['_id'] = self.pkFactory.createPk();
-    }
-  }
-
-  // Create the write command
-  var write_command = {
-      insert: namespace
-    , writeConcern: errorOptions
-    , ordered: !continueOnError
-    , documents: docs
-  }
-
-  // Execute the write command
-  self.db.command(write_command
-    , { connection:connection
-      , checkKeys: true
-      , serializeFunctions: serializeFunctions
-      , writeCommand: true }
-    , function(err, result) {  
-      if(errorOptions.w == 0 && typeof callback == 'function') return 
callback(null, null);
-      if(errorOptions.w == 0) return;
-      if(callback == null) return;
-      if(err != null) {
-        // Rewrite for backward compatibility
-        if(Array.isArray(err.errDetails)) err.code = err.errDetails[0].errCode;
-        // Return the error
-        return callback(err, null);
-      }
-
-      // Result has an error
-      if(!result.ok && (result.err != null || result.errmsg != null)) {
-        // Map the error
-        var error = utils.toError(result);        
-        // Backwards compatibility mapping
-        if(Array.isArray(error.errDetails)) error.code = 
error.errDetails[0].errCode;
-        // Return the error
-        return callback(error, null);
-      }
-
-      // Return the results for a whole batch
-      callback(null, docs)
-  });
-}
-
-//
-// Uses pre 2.6 OP_INSERT wire protocol
-//
-var insertAll = function insertAll (self, docs, options, callback) {
-  if('function' === typeof options) callback = options, options = {};
-  if(options == null) options = {};
-  if(!('function' === typeof callback)) callback = null;
-
-  // Insert options (flags for insert)
-  var insertFlags = {};
-  // If we have a mongodb version >= 1.9.1 support keepGoing attribute
-  if(options['keepGoing'] != null) {
-    insertFlags['keepGoing'] = options['keepGoing'];
-  }
-
-  // If we have a mongodb version >= 1.9.1 support keepGoing attribute
-  if(options['continueOnError'] != null) {
-    insertFlags['continueOnError'] = options['continueOnError'];
-  }
-
-  // DbName
-  var dbName = options['dbName'];
-  // If no dbname defined use the db one
-  if(dbName == null) {
-    dbName = self.db.databaseName;
-  }
-
-  // Either use override on the function, or go back to default on either the 
collection
-  // level or db
-  if(options['serializeFunctions'] != null) {
-    insertFlags['serializeFunctions'] = options['serializeFunctions'];
-  } else {
-    insertFlags['serializeFunctions'] = self.serializeFunctions;
-  }
-
-  // Get checkKeys value
-  var checkKeys = typeof options.checkKeys != 'boolean' ? true : 
options.checkKeys;
-
-  // Pass in options
-  var insertCommand = new InsertCommand(
-      self.db
-    , dbName + "." + self.collectionName, checkKeys, insertFlags);
-
-  // Add the documents and decorate them with id's if they have none
-  for(var index = 0, len = docs.length; index < len; ++index) {
-    var doc = docs[index];
-
-    // Add id to each document if it's not already defined
-    if (!(Buffer.isBuffer(doc))
-      && doc['_id'] == null
-      && self.db.forceServerObjectId != true
-      && options.forceServerObjectId != true) {
-        doc['_id'] = self.pkFactory.createPk();
-    }
-
-    insertCommand.add(doc);
-  }
-
-  // Collect errorOptions
-  var errorOptions = shared._getWriteConcern(self, options);
-  // Default command options
-  var commandOptions = {};
-  // If safe is defined check for error message
-  if(shared._hasWriteConcern(errorOptions) && typeof callback == 'function') {
-    // Insert options
-    commandOptions['read'] = false;
-    // If we have safe set set async to false
-    if(errorOptions == null) commandOptions['async'] = true;
-
-    // Set safe option
-    commandOptions['safe'] = errorOptions;
-    // If we have an error option
-    if(typeof errorOptions == 'object') {
-      var keys = Object.keys(errorOptions);
-      for(var i = 0; i < keys.length; i++) {
-        commandOptions[keys[i]] = errorOptions[keys[i]];
-      }
-    }
-
-    // Execute command with safe options (rolls up both command and safe 
command into one and executes them on the same connection)
-    self.db._executeInsertCommand(insertCommand, commandOptions, function 
(err, error) {
-      error = error && error.documents;
-      if(!callback) return;
-
-      if (err) {
-        callback(err);
-      } else if(error[0].err || error[0].errmsg) {
-        callback(utils.toError(error[0]));
-      } else if(error[0].jnote || error[0].wnote || error[0].wtimeout) {
-        callback(utils.toError(error[0]));
-      } else {
-        callback(null, docs);
-      }
-    });
-  } else if(shared._hasWriteConcern(errorOptions) && callback == null) {
-    throw new Error("Cannot use a writeConcern without a provided callback");
-  } else {
-    // Execute the call without a write concern
-    var result = self.db._executeInsertCommand(insertCommand, commandOptions);
-    // If no callback just return
-    if(!callback) return;
-    // If error return error
-    if(result instanceof Error) {
-      return callback(result);
-    }
-
-    // Otherwise just return
-    return callback(null, docs);
-  }
-};
-
-// ***************************************************
-// Remove function
-// ***************************************************
-var removeWithWriteCommands = function(self, selector, options, callback) {
-  if ('function' === typeof selector) {
-    callback = selector;
-    selector = options = {};
-  } else if ('function' === typeof options) {
-    callback = options;
-    options = {};
-  }
-
-  // Get the intended namespace for the operation
-  var namespace = self.collectionName;
-
-  // Ensure we have no \x00 bytes in the name causing wrong parsing
-  if(!!~namespace.indexOf("\x00")) {
-    return callback(new Error("namespace cannot contain a null character"), 
null);
-  }
-
-  // Set default empty selector if none
-  selector = selector == null ? {} : selector;
-
-  // Check if we have passed in continue on error
-  var continueOnError = typeof options['keepGoing'] == 'boolean' 
-    ? options['keepGoing'] : false;
-  continueOnError = typeof options['continueOnError'] == 'boolean' 
-    ? options['continueOnError'] : continueOnError;
-
-  // Do we serialzie functions
-  var serializeFunctions = typeof options.serializeFunctions != 'boolean' 
-    ? self.serializeFunctions : options.serializeFunctions;
-
-  // Checkout a write connection
-  var connection = self.db.serverConfig.checkoutWriter();  
-
-  // Figure out the value of top
-  var limit = options.single == true ? 1 : 0;
-  var upsert = typeof options.upsert == 'boolean' ? options.upsert : false;
-
-  // Collect errorOptions
-  var errorOptions = shared._getWriteConcern(self, options);
-
-  // If we have a write command with no callback and w:0 fail
-  if(errorOptions.w && errorOptions.w != 0 && callback == null) {
-    throw new Error("writeConcern requires callback")
-  }
-
-  // Create the write command
-  var write_command = {
-    delete: namespace,
-    writeConcern: errorOptions,
-    ordered: !continueOnError,
-    deletes: [{
-      q : selector,
-      limit: limit
-    }]
-  }
-
-  // Execute the write command
-  self.db.command(write_command
-    , { connection:connection
-      , checkKeys: true
-      , serializeFunctions: serializeFunctions
-      , writeCommand: true }
-    , function(err, result) {  
-      if(errorOptions.w == 0 && typeof callback == 'function') return 
callback(null, null);
-      if(errorOptions.w == 0) return;
-      if(callback == null) return;
-      if(err != null) {
-        if(Array.isArray(err.errDetails)) err.code = err.errDetails[0].errCode;
-        // Return the error
-        return callback(err, null);
-      }
-
-      // Result has an error
-      if(!result.ok  && (result.err != null || result.errmsg != null)) {
-        // Map the error
-        var error = utils.toError(result);        
-        // Backwards compatibility mapping
-        if(Array.isArray(error.errDetails)) error.code = 
error.errDetails[0].errCode;        
-        // Return the error
-        return callback(error, null);
-      }
-      
-      // Backward compatibility format
-      var r = backWardsCompatibiltyResults(result, 'remove');      
-      // Return the results for a whole batch
-      callback(null, r.n, r)
-  });
-}
-
-var remove = function remove(selector, options, callback) {
-  if('function' === typeof options) callback = options, options = null;
-  if(options == null) options = {};
-  if(!('function' === typeof callback)) callback = null;
-  // Get a connection
-  var connection = this.db.serverConfig.checkoutWriter();
-  var useLegacyOps = options.useLegacyOps == null || options.useLegacyOps == 
false ? false : true;
-  // If we support write commands let's perform the insert using it  
-  if(!useLegacyOps && hasWriteCommands(connection) && 
!Buffer.isBuffer(selector)) {
-    return removeWithWriteCommands(this, selector, options, callback);
-  }
-
-  if ('function' === typeof selector) {
-    callback = selector;
-    selector = options = {};
-  } else if ('function' === typeof options) {
-    callback = options;
-    options = {};
-  }
-
-  // Ensure options
-  if(options == null) options = {};
-  if(!('function' === typeof callback)) callback = null;
-  // Ensure we have at least an empty selector
-  selector = selector == null ? {} : selector;
-  // Set up flags for the command, if we have a single document remove
-  var flags = 0 | (options.single ? 1 : 0);
-
-  // DbName
-  var dbName = options['dbName'];
-  // If no dbname defined use the db one
-  if(dbName == null) {
-    dbName = this.db.databaseName;
-  }
-
-  // Create a delete command
-  var deleteCommand = new DeleteCommand(
-      this.db
-    , dbName + "." + this.collectionName
-    , selector
-    , flags);
-
-  var self = this;
-  var errorOptions = shared._getWriteConcern(self, options);
-  // Execute the command, do not add a callback as it's async
-  if(shared._hasWriteConcern(errorOptions) && typeof callback == 'function') {
-    // Insert options
-    var commandOptions = {read:false};
-    // If we have safe set set async to false
-    if(errorOptions == null) commandOptions['async'] = true;
-    // Set safe option
-    commandOptions['safe'] = true;
-    // If we have an error option
-    if(typeof errorOptions == 'object') {
-      var keys = Object.keys(errorOptions);
-      for(var i = 0; i < keys.length; i++) {
-        commandOptions[keys[i]] = errorOptions[keys[i]];
-      }
-    }
-
-    // Execute command with safe options (rolls up both command and safe 
command into one and executes them on the same connection)
-    this.db._executeRemoveCommand(deleteCommand, commandOptions, function 
(err, error) {
-      error = error && error.documents;
-      if(!callback) return;
-
-      if(err) {
-        callback(err);
-      } else if(error[0].err || error[0].errmsg) {
-        callback(utils.toError(error[0]));
-      } else if(error[0].jnote || error[0].wnote || error[0].wtimeout) {
-        callback(utils.toError(error[0]));
-      } else {
-        callback(null, error[0].n);
-      }
-    });
-  } else if(shared._hasWriteConcern(errorOptions) && callback == null) {
-    throw new Error("Cannot use a writeConcern without a provided callback");
-  } else {
-    var result = this.db._executeRemoveCommand(deleteCommand);
-    // If no callback just return
-    if (!callback) return;
-    // If error return error
-    if (result instanceof Error) {
-      return callback(result);
-    }
-    // Otherwise just return
-    return callback();
-  }
-};
-
-// ***************************************************
-// Save function
-// ***************************************************
-var save = function save(doc, options, callback) {
-  if('function' === typeof options) callback = options, options = null;
-  if(options == null) options = {};
-  if(!('function' === typeof callback)) callback = null;
-  // Throw an error if attempting to perform a bulk operation
-  if(Array.isArray(doc)) throw new Error("doc parameter must be a single 
document");
-  // Extract the id, if we have one we need to do a update command
-  var id = doc['_id'];
-  var commandOptions = shared._getWriteConcern(this, options);
-
-  if(id != null) {
-    commandOptions.upsert = true;
-    this.update({ _id: id }, doc, commandOptions, callback);
-  } else {
-    this.insert(doc, commandOptions, callback && function (err, docs) {
-      if(err) return callback(err, null);
-
-      if(Array.isArray(docs)) {
-        callback(err, docs[0]);
-      } else {
-        callback(err, docs);
-      }
-    });
-  }
-};
-
-// ***************************************************
-// Update document function
-// ***************************************************
-var updateWithWriteCommands = function(self, selector, document, options, 
callback) {
-  if('function' === typeof options) callback = options, options = null;
-  if(options == null) options = {};
-  if(!('function' === typeof callback)) callback = null;
-
-  // Get the intended namespace for the operation
-  var namespace = self.collectionName;
-
-  // Ensure we have no \x00 bytes in the name causing wrong parsing
-  if(!!~namespace.indexOf("\x00")) {
-    return callback(new Error("namespace cannot contain a null character"), 
null);
-  }
-
-  // If we are not providing a selector or document throw
-  if(selector == null || typeof selector != 'object') 
-    return callback(new Error("selector must be a valid JavaScript object"));
-  if(document == null || typeof document != 'object') 
-    return callback(new Error("document must be a valid JavaScript object"));  
  
-
-  // Check if we have passed in continue on error
-  var continueOnError = typeof options['keepGoing'] == 'boolean' 
-    ? options['keepGoing'] : false;
-  continueOnError = typeof options['continueOnError'] == 'boolean' 
-    ? options['continueOnError'] : continueOnError;
-
-  // Do we serialzie functions
-  var serializeFunctions = typeof options.serializeFunctions != 'boolean' 
-    ? self.serializeFunctions : options.serializeFunctions;
-
-  // Checkout a write connection
-  var connection = self.db.serverConfig.checkoutWriter();  
-
-  // Figure out the value of top
-  var multi = typeof options.multi == 'boolean' ? options.multi : false;
-  var upsert = typeof options.upsert == 'boolean' ? options.upsert : false;
-
-  // Collect errorOptions
-  var errorOptions = shared._getWriteConcern(self, options);
-
-  // If we have a write command with no callback and w:0 fail
-  if(errorOptions.w && errorOptions.w != 0 && callback == null) {
-    throw new Error("writeConcern requires callback")
-  }
-
-  // Create the write command
-  var write_command = {
-    update: namespace,
-    writeConcern: errorOptions,
-    ordered: !continueOnError,
-    updates: [{
-      q : selector,
-      u: document,
-      multi: multi,
-      upsert: upsert
-    }]
-  }
-
-  // Check if we have a checkKeys override
-  var checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : 
false;
-
-  // Execute the write command
-  self.db.command(write_command
-    , { connection:connection
-      , checkKeys: checkKeys
-      , serializeFunctions: serializeFunctions
-      , writeCommand: true }
-    , function(err, result) { 
-      if(errorOptions.w == 0 && typeof callback == 'function') return 
callback(null, null);
-      if(errorOptions.w == 0) return;
-      if(callback == null) return;
-      if(err != null) {
-        if(Array.isArray(err.errDetails)) err.code = err.errDetails[0].errCode;
-        // Return the error
-        return callback(err, null);
-      }
-
-      // Result has an error
-      if(!result.ok  && (result.err != null || result.errmsg != null)) {
-        // Map the error
-        var error = utils.toError(result);        
-        // Backwards compatibility mapping
-        if(Array.isArray(error.errDetails)) error.code = 
error.errDetails[0].errCode;        
-        // Return the error
-        return callback(error, null);
-      }
-      
-      // Backward compatibility format
-      var r = backWardsCompatibiltyResults(result, 'update');
-      // Return the results for a whole batch
-      callback(null, r.n, r)
-  });
-}
-
-var backWardsCompatibiltyResults = function(result, op) {
-  // Upserted
-  var upsertedValue = null;
-  var finalResult = null;
-  var updatedExisting = true;
-
-  // We have a single document upserted result
-  if(Array.isArray(result.upserted) || result.upserted != null) {
-    updatedExisting = false;
-    upsertedValue = result.upserted;
-  }
-
-  // Final result
-  if(op == 'remove' || op == 'insert') {
-    finalResult = {ok: true, n: result.n}
-  } else {
-    finalResult = {ok: true, n: result.n, updatedExisting: updatedExisting}    
-  }
-
-  if(upsertedValue != null) finalResult.upserted = upsertedValue;
-  return finalResult;
-}
-
-var update = function update(selector, document, options, callback) {
-  if('function' === typeof options) callback = options, options = null;
-  if(options == null) options = {};
-  if(!('function' === typeof callback)) callback = null;
-
-  // Get a connection
-  var connection = this.db.serverConfig.checkoutWriter();
-  var useLegacyOps = options.useLegacyOps == null || options.useLegacyOps == 
false ? false : true;
-  // If we support write commands let's perform the insert using it  
-  if(!useLegacyOps && hasWriteCommands(connection) && 
!Buffer.isBuffer(selector) && !Buffer.isBuffer(document)) {
-    return updateWithWriteCommands(this, selector, document, options, 
callback);
-  }
-
-  // DbName
-  var dbName = options['dbName'];
-  // If no dbname defined use the db one
-  if(dbName == null) {
-    dbName = this.db.databaseName;
-  }
-
-  // If we are not providing a selector or document throw
-  if(selector == null || typeof selector != 'object') return callback(new 
Error("selector must be a valid JavaScript object"));
-  if(document == null || typeof document != 'object') return callback(new 
Error("document must be a valid JavaScript object"));
-
-  // Either use override on the function, or go back to default on either the 
collection
-  // level or db
-  if(options['serializeFunctions'] != null) {
-    options['serializeFunctions'] = options['serializeFunctions'];
-  } else {
-    options['serializeFunctions'] = this.serializeFunctions;
-  }
-
-  // Build the options command
-  var updateCommand = new UpdateCommand(
-      this.db
-    , dbName + "." + this.collectionName
-    , selector
-    , document
-    , options);
-
-  var self = this;
-  // Unpack the error options if any
-  var errorOptions = shared._getWriteConcern(this, options);
-  // If safe is defined check for error message
-  if(shared._hasWriteConcern(errorOptions) && typeof callback == 'function') {
-    // Insert options
-    var commandOptions = {read:false};
-    // If we have safe set set async to false
-    if(errorOptions == null) commandOptions['async'] = true;
-    // Set safe option
-    commandOptions['safe'] = errorOptions;
-    // If we have an error option
-    if(typeof errorOptions == 'object') {
-      var keys = Object.keys(errorOptions);
-      for(var i = 0; i < keys.length; i++) {
-        commandOptions[keys[i]] = errorOptions[keys[i]];
-      }
-    }
-
-    // Execute command with safe options (rolls up both command and safe 
command into one and executes them on the same connection)
-    this.db._executeUpdateCommand(updateCommand, commandOptions, function 
(err, error) {
-      error = error && error.documents;
-      if(!callback) return;
-
-      if(err) {
-        callback(err);
-      } else if(error[0].err || error[0].errmsg) {
-        callback(utils.toError(error[0]));
-      } else if(error[0].jnote || error[0].wnote || error[0].wtimeout) {
-        callback(utils.toError(error[0]));
-      } else {
-        callback(null, error[0].n, error[0]);
-      }
-    });
-  } else if(shared._hasWriteConcern(errorOptions) && callback == null) {
-    throw new Error("Cannot use a writeConcern without a provided callback");
-  } else {
-    // Execute update
-    var result = this.db._executeUpdateCommand(updateCommand);
-    // If no callback just return
-    if (!callback) return;
-    // If error return error
-    if (result instanceof Error) {
-      return callback(result);
-    }
-    // Otherwise just return
-    return callback();
-  }
-};
-
-// ***************************************************
-// findAndModify function
-// ***************************************************
-var findAndModify = function findAndModify (query, sort, doc, options, 
callback) {
-  var args = Array.prototype.slice.call(arguments, 1);
-  callback = args.pop();
-  sort = args.length ? args.shift() || [] : [];
-  doc = args.length ? args.shift() : null;
-  options = args.length ? args.shift() || {} : {};
-  var self = this;
-
-  var queryObject = {
-      'findandmodify': this.collectionName
-    , 'query': query
-    , 'sort': utils.formattedOrderClause(sort)
-  };
-
-  queryObject.new = options.new ? 1 : 0;
-  queryObject.remove = options.remove ? 1 : 0;
-  queryObject.upsert = options.upsert ? 1 : 0;
-
-  if (options.fields) {
-    queryObject.fields = options.fields;
-  }
-
-  if (doc && !options.remove) {
-    queryObject.update = doc;
-  }
-
-  // Checkout a write connection
-  options.connection = self.db.serverConfig.checkoutWriter();  
-
-  // Either use override on the function, or go back to default on either the 
collection
-  // level or db
-  if(options['serializeFunctions'] != null) {
-    options['serializeFunctions'] = options['serializeFunctions'];
-  } else {
-    options['serializeFunctions'] = this.serializeFunctions;
-  }
-
-  // No check on the documents
-  options.checkKeys = false
-
-  // Execute the command
-  this.db.command(queryObject
-    , options, function(err, result) {
-      if(err) return callback(err, null);
-      return callback(null, result.value, result);
-  });
-}
-
-// ***************************************************
-// findAndRemove function
-// ***************************************************
-var findAndRemove = function(query, sort, options, callback) {
-  var args = Array.prototype.slice.call(arguments, 1);
-  callback = args.pop();
-  sort = args.length ? args.shift() || [] : [];
-  options = args.length ? args.shift() || {} : {};
-  // Add the remove option
-  options['remove'] = true;
-  // Execute the callback
-  this.findAndModify(query, sort, null, options, callback);
-}
-
-// Map methods
-exports.insert = insert;
-exports.remove = remove;
-exports.save = save;
-exports.update = update;
-exports.findAndModify = findAndModify;
-exports.findAndRemove = findAndRemove;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/mongodb/lib/mongodb/collection/geo.js
----------------------------------------------------------------------
diff --git 
a/web/demos/package/node_modules/mongodb/lib/mongodb/collection/geo.js 
b/web/demos/package/node_modules/mongodb/lib/mongodb/collection/geo.js
deleted file mode 100644
index d2d3f9e..0000000
--- a/web/demos/package/node_modules/mongodb/lib/mongodb/collection/geo.js
+++ /dev/null
@@ -1,78 +0,0 @@
-var shared = require('./shared')
-  , utils = require('../utils');
-
-var geoNear = function geoNear(x, y, options, callback) {
-  var args = Array.prototype.slice.call(arguments, 2);
-  callback = args.pop();
-  // Fetch all commands
-  options = args.length ? args.shift() || {} : {};
-
-  // Build command object
-  var commandObject = {
-    geoNear:this.collectionName,
-    near: [x, y]
-  }
-
-  // Decorate object if any with known properties
-  if(options['num'] != null) commandObject['num'] = options['num'];
-  if(options['maxDistance'] != null) commandObject['maxDistance'] = 
options['maxDistance'];
-  if(options['distanceMultiplier'] != null) 
commandObject['distanceMultiplier'] = options['distanceMultiplier'];
-  if(options['query'] != null) commandObject['query'] = options['query'];
-  if(options['spherical'] != null) commandObject['spherical'] = 
options['spherical'];
-  if(options['uniqueDocs'] != null) commandObject['uniqueDocs'] = 
options['uniqueDocs'];
-  if(options['includeLocs'] != null) commandObject['includeLocs'] = 
options['includeLocs'];
-
-  // Ensure we have the right read preference inheritance
-  options.readPreference = shared._getReadConcern(this, options);
-
-  // Execute the command
-  this.db.command(commandObject, options, function (err, res) {
-    if (err) {
-      callback(err);
-    } else if (res.err || res.errmsg) {
-      callback(utils.toError(res));
-    } else {
-      // should we only be returning res.results here? Not sure if the user
-      // should see the other return information
-      callback(null, res);
-    }
-  });
-}
-
-var geoHaystackSearch = function geoHaystackSearch(x, y, options, callback) {
-  var args = Array.prototype.slice.call(arguments, 2);
-  callback = args.pop();
-  // Fetch all commands
-  options = args.length ? args.shift() || {} : {};
-
-  // Build command object
-  var commandObject = {
-    geoSearch:this.collectionName,
-    near: [x, y]
-  }
-
-  // Decorate object if any with known properties
-  if(options['maxDistance'] != null) commandObject['maxDistance'] = 
options['maxDistance'];
-  if(options['query'] != null) commandObject['search'] = options['query'];
-  if(options['search'] != null) commandObject['search'] = options['search'];
-  if(options['limit'] != null) commandObject['limit'] = options['limit'];
-
-  // Ensure we have the right read preference inheritance
-  options.readPreference = shared._getReadConcern(this, options);
-
-  // Execute the command
-  this.db.command(commandObject, options, function (err, res) {
-    if (err) {
-      callback(err);
-    } else if (res.err || res.errmsg) {
-      callback(utils.toError(res));
-    } else {
-      // should we only be returning res.results here? Not sure if the user
-      // should see the other return information
-      callback(null, res);
-    }
-  });
-}
-
-exports.geoNear = geoNear;
-exports.geoHaystackSearch = geoHaystackSearch;

http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/mongodb/lib/mongodb/collection/index.js
----------------------------------------------------------------------
diff --git 
a/web/demos/package/node_modules/mongodb/lib/mongodb/collection/index.js 
b/web/demos/package/node_modules/mongodb/lib/mongodb/collection/index.js
deleted file mode 100644
index dda9cc8..0000000
--- a/web/demos/package/node_modules/mongodb/lib/mongodb/collection/index.js
+++ /dev/null
@@ -1,72 +0,0 @@
-var _getWriteConcern = require('./shared')._getWriteConcern;
-
-var createIndex = function createIndex (fieldOrSpec, options, callback) {
-  // Clean up call
-  var args = Array.prototype.slice.call(arguments, 1);
-  callback = args.pop();
-  options = args.length ? args.shift() || {} : {};
-  options = typeof callback === 'function' ? options : callback;
-  options = options == null ? {} : options;
-
-  // Collect errorOptions
-  var errorOptions = _getWriteConcern(this, options);
-  // Execute create index
-  this.db.createIndex(this.collectionName, fieldOrSpec, options, callback);
-};
-
-var indexExists = function indexExists(indexes, callback) {
- this.indexInformation(function(err, indexInformation) {
-   // If we have an error return
-   if(err != null) return callback(err, null);
-   // Let's check for the index names
-   if(Array.isArray(indexes)) {
-     for(var i = 0; i < indexes.length; i++) {
-       if(indexInformation[indexes[i]] == null) {
-         return callback(null, false);
-       }
-     }
-
-     // All keys found return true
-     return callback(null, true);
-   } else {
-     return callback(null, indexInformation[indexes] != null);
-   }
- });
-}
-
-var dropAllIndexes = function dropIndexes (callback) {
-  this.db.dropIndex(this.collectionName, '*', function (err, result) {
-    if(err) return callback(err, false);
-    callback(null, true);
-  });
-};
-
-var indexInformation = function indexInformation (options, callback) {
-  // Unpack calls
-  var args = Array.prototype.slice.call(arguments, 0);
-  callback = args.pop();
-  options = args.length ? args.shift() || {} : {};
-  // Call the index information
-  this.db.indexInformation(this.collectionName, options, callback);
-};
-
-var ensureIndex = function ensureIndex (fieldOrSpec, options, callback) {
-  // Clean up call
-  if (typeof callback === 'undefined' && typeof options === 'function') {
-    callback = options;
-    options = {};
-  }
-
-  if (options == null) {
-    options = {};
-  }
-
-  // Execute create index
-  this.db.ensureIndex(this.collectionName, fieldOrSpec, options, callback);
-};
-
-exports.createIndex = createIndex;
-exports.indexExists = indexExists;
-exports.dropAllIndexes = dropAllIndexes;
-exports.indexInformation = indexInformation;
-exports.ensureIndex = ensureIndex;

Reply via email to