Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 2.2KB

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