index.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Core module
  2. var core = require('mongodb-core'),
  3. Instrumentation = require('./lib/apm');
  4. // Set up the connect function
  5. var connect = require('./lib/mongo_client').connect;
  6. // Expose error class
  7. connect.MongoError = core.MongoError;
  8. // Actual driver classes exported
  9. connect.Admin = require('./lib/admin');
  10. connect.MongoClient = require('./lib/mongo_client');
  11. connect.Db = require('./lib/db');
  12. connect.Collection = require('./lib/collection');
  13. connect.Server = require('./lib/server');
  14. connect.ReplSet = require('./lib/replset');
  15. connect.Mongos = require('./lib/mongos');
  16. connect.ReadPreference = require('./lib/read_preference');
  17. connect.GridStore = require('./lib/gridfs/grid_store');
  18. connect.Chunk = require('./lib/gridfs/chunk');
  19. connect.Logger = core.Logger;
  20. connect.Cursor = require('./lib/cursor');
  21. connect.GridFSBucket = require('./lib/gridfs-stream');
  22. // Exported to be used in tests not to be used anywhere else
  23. connect.CoreServer = require('mongodb-core').Server;
  24. connect.CoreConnection = require('mongodb-core').Connection;
  25. // BSON types exported
  26. connect.Binary = core.BSON.Binary;
  27. connect.Code = core.BSON.Code;
  28. connect.Map = core.BSON.Map;
  29. connect.DBRef = core.BSON.DBRef;
  30. connect.Double = core.BSON.Double;
  31. connect.Int32 = core.BSON.Int32;
  32. connect.Long = core.BSON.Long;
  33. connect.MinKey = core.BSON.MinKey;
  34. connect.MaxKey = core.BSON.MaxKey;
  35. connect.ObjectID = core.BSON.ObjectID;
  36. connect.ObjectId = core.BSON.ObjectID;
  37. connect.Symbol = core.BSON.Symbol;
  38. connect.Timestamp = core.BSON.Timestamp;
  39. connect.Decimal128 = core.BSON.Decimal128;
  40. // Add connect method
  41. connect.connect = connect;
  42. // Set up the instrumentation method
  43. connect.instrument = function(options, callback) {
  44. if(typeof options == 'function') callback = options, options = {};
  45. return new Instrumentation(core, options, callback);
  46. }
  47. // Set our exports to be the connect function
  48. module.exports = connect;