1 | 'use strict';
|
2 |
|
3 |
|
4 | const core = require('./lib/core');
|
5 | const Instrumentation = require('./lib/apm');
|
6 |
|
7 |
|
8 | const connect = require('./lib/mongo_client').connect;
|
9 |
|
10 |
|
11 | connect.MongoError = core.MongoError;
|
12 | connect.MongoNetworkError = core.MongoNetworkError;
|
13 | connect.MongoTimeoutError = core.MongoTimeoutError;
|
14 | connect.MongoServerSelectionError = core.MongoServerSelectionError;
|
15 | connect.MongoParseError = core.MongoParseError;
|
16 | connect.MongoWriteConcernError = core.MongoWriteConcernError;
|
17 | connect.MongoBulkWriteError = require('./lib/bulk/common').BulkWriteError;
|
18 | connect.BulkWriteError = connect.MongoBulkWriteError;
|
19 |
|
20 |
|
21 | connect.Admin = require('./lib/admin');
|
22 | connect.MongoClient = require('./lib/mongo_client');
|
23 | connect.Db = require('./lib/db');
|
24 | connect.Collection = require('./lib/collection');
|
25 | connect.Server = require('./lib/topologies/server');
|
26 | connect.ReplSet = require('./lib/topologies/replset');
|
27 | connect.Mongos = require('./lib/topologies/mongos');
|
28 | connect.ReadPreference = core.ReadPreference;
|
29 | connect.GridStore = require('./lib/gridfs/grid_store');
|
30 | connect.Chunk = require('./lib/gridfs/chunk');
|
31 | connect.Logger = core.Logger;
|
32 | connect.AggregationCursor = require('./lib/aggregation_cursor');
|
33 | connect.CommandCursor = require('./lib/command_cursor');
|
34 | connect.Cursor = require('./lib/cursor');
|
35 | connect.GridFSBucket = require('./lib/gridfs-stream');
|
36 |
|
37 | connect.CoreServer = core.Server;
|
38 | connect.CoreConnection = core.Connection;
|
39 |
|
40 |
|
41 | connect.Binary = core.BSON.Binary;
|
42 | connect.Code = core.BSON.Code;
|
43 | connect.Map = core.BSON.Map;
|
44 | connect.DBRef = core.BSON.DBRef;
|
45 | connect.Double = core.BSON.Double;
|
46 | connect.Int32 = core.BSON.Int32;
|
47 | connect.Long = core.BSON.Long;
|
48 | connect.MinKey = core.BSON.MinKey;
|
49 | connect.MaxKey = core.BSON.MaxKey;
|
50 | connect.ObjectID = core.BSON.ObjectID;
|
51 | connect.ObjectId = core.BSON.ObjectID;
|
52 | connect.Symbol = core.BSON.Symbol;
|
53 | connect.Timestamp = core.BSON.Timestamp;
|
54 | connect.BSONRegExp = core.BSON.BSONRegExp;
|
55 | connect.Decimal128 = core.BSON.Decimal128;
|
56 |
|
57 |
|
58 | connect.connect = connect;
|
59 |
|
60 |
|
61 | connect.instrument = function(options, callback) {
|
62 | if (typeof options === 'function') {
|
63 | callback = options;
|
64 | options = {};
|
65 | }
|
66 |
|
67 | const instrumentation = new Instrumentation();
|
68 | instrumentation.instrument(connect.MongoClient, callback);
|
69 | return instrumentation;
|
70 | };
|
71 |
|
72 |
|
73 | module.exports = connect;
|