Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,18 @@
"rules": {
"no-console": "off",
"no-restricted-syntax": "off",
"typescript-eslint/ban-ts-comment": "off"
"typescript-eslint/ban-ts-comment": "off",
"no-restricted-imports": "off",
"@typescript-eslint/no-restricted-imports": [
"error",
{
"patterns": [
"**/../lib/**",
"**/../src/**",
"mongodb-mock-server"
]
}
]
}
},
{
Expand Down Expand Up @@ -227,7 +238,6 @@
{
"patterns": [
"**/../lib/**",
"**/../src/**",
"mongodb-mock-server"
]
}
Expand Down
1 change: 0 additions & 1 deletion src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ import {
Callback,
checkCollectionName,
DEFAULT_PK_FACTORY,
emitWarningOnce,
MongoDBNamespace,
normalizeHintField,
resolveOptions
Expand Down
2 changes: 1 addition & 1 deletion test/integration/auth/mongodb_aws.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as http from 'http';
import { performance } from 'perf_hooks';
import * as sinon from 'sinon';

import { MongoAWSError, MongoClient, MongoServerError } from '../../../src';
import { MongoAWSError, MongoClient, MongoServerError } from '../../mongodb';
import { removeAuthFromConnectionString } from '../../tools/utils';

describe('MONGODB-AWS', function () {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/auth/scram_sha_1.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';

import type { MongoClient } from '../../../src';
import type { MongoClient } from '../../mongodb';

describe('SCRAM-SHA-1', function () {
let client: MongoClient;
Expand Down
2 changes: 1 addition & 1 deletion test/integration/auth/ssl_x509_connect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const fs = require('fs');
const { format: f } = require('util');
const { test, setupDatabase } = require('../shared');
const { expect } = require('chai');
const { MongoClient } = require('../../../src');
const { MongoClient } = require('../../mongodb');

describe('SSL (x509)', function () {
before(function () {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/bson-decimal128/decimal128.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const { assert: test } = require('../shared');
const { expect } = require('chai');
const { setupDatabase } = require('../shared');
const { Decimal128 } = require('../../../src');
const { Decimal128 } = require('../../mongodb');

describe('Decimal128', function () {
before(function () {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/change-streams/change_stream.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import {
Collection,
CommandStartedEvent,
Db,
isHello,
Long,
MongoAPIError,
MongoChangeStreamError,
MongoClient,
MongoServerError,
ReadPreference,
ResumeToken
} from '../../../src';
import { isHello } from '../../mongodb';
} from '../../mongodb';
import * as mock from '../../tools/mongodb-mock/index';
import {
FailPoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import {
CommandStartedEvent,
CommandSucceededEvent,
Document,
isHello,
LEGACY_HELLO_COMMAND,
Long,
MongoNetworkError,
ObjectId,
Timestamp
} from '../../../src';
import { isHello, LEGACY_HELLO_COMMAND } from '../../mongodb';
} from '../../mongodb';
import * as mock from '../../tools/mongodb-mock/index';
import { setupDatabase } from '../shared';

Expand Down
2 changes: 1 addition & 1 deletion test/integration/client-side-encryption/driver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EJSON, UUID } from 'bson';
import { expect } from 'chai';
import * as crypto from 'crypto';

import { Collection, CommandStartedEvent, MongoClient } from '../../../src';
import { Collection, CommandStartedEvent, MongoClient } from '../../mongodb';
import * as BSON from '../../mongodb';
import { installNodeDNSWorkaroundHooks } from '../../tools/runner/hooks/configuration';
import { ClientEncryption } from '../../tools/unified-spec-runner/schema';
Expand Down
3 changes: 1 addition & 2 deletions test/integration/collection-management/collection.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from 'chai';

import { Collection, Db, MongoClient } from '../../../src';
import { isHello } from '../../mongodb';
import { Collection, Db, isHello, MongoClient } from '../../mongodb';
import * as mock from '../../tools/mongodb-mock/index';
import { setupDatabase } from '../shared';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { expect } from 'chai';

import { MongoClient, MongoServerError, ServerHeartbeatStartedEvent } from '../../../src';
import {
connect,
Connection,
HostAddress,
LEGACY_HELLO_COMMAND,
MongoClient,
MongoServerError,
ns,
ServerHeartbeatStartedEvent,
Topology
} from '../../mongodb';
import { skipBrokenAuthTestBeforeEachHook } from '../../tools/runner/hooks/configuration';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';

import type { Collection, Db, MongoClient } from '../../../src';
import type { Collection, Db, MongoClient } from '../../mongodb';
import { skipBrokenAuthTestBeforeEachHook } from '../../tools/runner/hooks/configuration';

function ignoreNsNotFound(err) {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/crud/bulk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
MongoClient,
MongoDriverError,
MongoInvalidArgumentError
} from '../../../src';
} from '../../mongodb';
import { assert as test, ignoreNsNotFound } from '../shared';

const MAX_BSON_SIZE = 16777216;
Expand Down
2 changes: 1 addition & 1 deletion test/integration/crud/crud.prose.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { expect } = require('chai');
const { once } = require('events');
const { MongoBulkWriteError, MongoServerError } = require('../../../src');
const { MongoBulkWriteError, MongoServerError } = require('../../mongodb');

describe('CRUD Prose Spec Tests', () => {
let client;
Expand Down
2 changes: 1 addition & 1 deletion test/integration/crud/crud_api.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';

import { MongoClient, MongoError, ObjectId, ReturnDocument } from '../../../src';
import { MongoClient, MongoError, ObjectId, ReturnDocument } from '../../mongodb';
import { assert as test } from '../shared';

// instanceof cannot be use reliably to detect the new models in js due to scoping and new
Expand Down
2 changes: 1 addition & 1 deletion test/integration/crud/explain.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const { setupDatabase } = require('../shared');
const { MongoServerError } = require('../../../src');
const { MongoServerError } = require('../../mongodb');
const chai = require('chai');

const expect = chai.expect;
Expand Down
2 changes: 1 addition & 1 deletion test/integration/crud/find.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { assert: test } = require('../shared');
const { expect } = require('chai');
const sinon = require('sinon');
const { setTimeout } = require('timers');
const { Code, ObjectId, Long, Binary, ReturnDocument } = require('../../../src');
const { Code, ObjectId, Long, Binary, ReturnDocument } = require('../../mongodb');

describe('Find', function () {
let client;
Expand Down
2 changes: 1 addition & 1 deletion test/integration/crud/insert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const {
Code,
MongoBulkWriteError,
ReturnDocument
} = require('../../../src');
} = require('../../mongodb');

/**
* Module for parsing an ISO 8601 formatted string into a Date object.
Expand Down
2 changes: 1 addition & 1 deletion test/integration/crud/maxTimeMS.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
MongoClient,
MongoCursorExhaustedError,
MongoServerError
} from '../../../src';
} from '../../mongodb';
import { getSymbolFrom } from '../../tools/utils';

describe('MaxTimeMS', function () {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/crud/pk_factory.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
const { expect } = require('chai');
const { setupDatabase } = require('../../integration/shared');
const { ObjectId } = require('../../../src');
const { ObjectId } = require('../../mongodb');

describe('PkFactory', function () {
before(function () {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/crud/server_errors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const chai = require('chai');

const expect = chai.expect;
const sinonChai = require('sinon-chai');
const { MongoServerError } = require('../../../src');
const { MongoServerError } = require('../../mongodb');

chai.use(sinonChai);

Expand Down
2 changes: 1 addition & 1 deletion test/integration/enumerate_databases.prose.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';

import type { MongoClient } from '../../src';
import type { MongoClient } from '../mongodb';

const REQUIRED_DBS = ['admin', 'local', 'config'];
const DB_NAME = 'listDatabasesTest';
Expand Down
2 changes: 1 addition & 1 deletion test/integration/enumerate_databases.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';

import { AddUserOptions, MongoClient, MongoServerError } from '../../src';
import { AddUserOptions, MongoClient, MongoServerError } from '../mongodb';
import { TestBuilder, UnifiedTestSuiteBuilder } from '../tools/utils';

const metadata: MongoDBMetadataUI = {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/gridfs/gridfs.spec.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { EJSON } = require('bson');
const { setupDatabase } = require('./../shared');
const { expect } = require('chai');
const { GridFSBucket } = require('../../../src');
const { GridFSBucket } = require('../../mongodb');

describe('GridFS spec', function () {
before(function () {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/gridfs/gridfs.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import { once } from 'events';

import { type Db, type MongoClient, CommandStartedEvent, GridFSBucket } from '../../../src';
import { type Db, type MongoClient, CommandStartedEvent, GridFSBucket } from '../../mongodb';
import { sleep } from '../../tools/utils';

describe('GridFS', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/gridfs/gridfs_stream.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Double } = require('bson');
const stream = require('stream');
const fs = require('fs');
const { expect } = require('chai');
const { GridFSBucket, ObjectId } = require('../../../src');
const { GridFSBucket, ObjectId } = require('../../mongodb');
const sinon = require('sinon');
const { sleep } = require('../../tools/utils');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import * as fs from 'fs';
import * as path from 'path';
import { promisify } from 'util';

import { MongoClient } from '../../../src';
import { HostAddress } from '../../mongodb';
import { HostAddress, MongoClient } from '../../mongodb';

function makeTest(test, topology) {
let client;
Expand Down
2 changes: 1 addition & 1 deletion test/integration/max-staleness/max_staleness.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const { Long } = require('bson');
const { expect } = require('chai');
const mock = require('../../tools/mongodb-mock/index');
const { ReadPreference } = require('../../../src');
const { ReadPreference } = require('../../mongodb');
const { isHello } = require('../../mongodb');

const test = {};
Expand Down
2 changes: 1 addition & 1 deletion test/integration/node-specific/abstract_cursor.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import { inspect } from 'util';

import { Collection, MongoAPIError, MongoClient } from '../../../src';
import { Collection, MongoAPIError, MongoClient } from '../../mongodb';

const falseyValues = [0, 0n, NaN, '', false, undefined];

Expand Down
5 changes: 3 additions & 2 deletions test/integration/node-specific/auto_connect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import { once } from 'events';
import {
BSONType,
ChangeStream,
ClientSession,
Collection,
MongoClient,
MongoNotConnectedError,
ProfilingLevel,
Topology,
TopologyType
} from '../../../src';
import { ClientSession, Topology } from '../../mongodb';
} from '../../mongodb';

describe('When executing an operation for the first time', () => {
let client: MongoClient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
const { expect } = require('chai');
const { assert: test, setupDatabase } = require('../../shared');
const { ObjectId } = require('../../../../src');
const { ObjectId } = require('../../../mongodb');

describe('Ignore Undefined', function () {
before(function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const { expect } = require('chai');
const { Long, Int32, Double } = require('../../../../src');
const { Long, Int32, Double } = require('../../../mongodb');
const { assert: test, setupDatabase } = require('../../shared');

describe('Promote Values', function () {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/node-specific/bson-options/raw.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';

import { Collection, MongoClient, MongoCompatibilityError, ObjectId } from '../../../../src';
import { Collection, MongoClient, MongoCompatibilityError, ObjectId } from '../../../mongodb';

describe('raw bson support', () => {
describe('raw', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';

import { Collection, CommandStartedEvent, Long, MongoClient } from '../../../src';
import { Collection, CommandStartedEvent, Long, MongoClient } from '../../mongodb';
import { TestBuilder, UnifiedTestSuiteBuilder } from '../../tools/utils';

const falsyValues = [0, false, '', Long.ZERO, null, NaN] as const;
Expand Down
2 changes: 1 addition & 1 deletion test/integration/node-specific/cursor_stream.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const { expect } = require('chai');
const { Binary } = require('../../../src');
const { Binary } = require('../../mongodb');
const { setTimeout, setImmediate } = require('timers');

describe('Cursor Streams', function () {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/node-specific/db.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const { setupDatabase, assert: test } = require(`../shared`);
const { expect } = require('chai');
const { Db, MongoClient } = require('../../../src');
const { Db, MongoClient } = require('../../mongodb');

describe('Db', function () {
before(function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const { MongoClient } = require('../../../../src');
const { MongoClient } = require('../../../mongodb');

// Yes, we are shadowing a global here but we are not actually ever printing anything in this file
// This just so the examples can use console.log to make for nice copy pasting
Expand Down
2 changes: 1 addition & 1 deletion test/integration/node-specific/examples/versioned_api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const { MongoClient } = require('../../../../src');
const { MongoClient } = require('../../../mongodb');

describe('examples.versionedApi:', function () {
let uri;
Expand Down
3 changes: 1 addition & 2 deletions test/integration/node-specific/feature_flags.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from 'chai';

import { MongoClient } from '../../../src';
import { MongoLoggableComponent, SeverityLevel } from '../../mongodb';
import { MongoClient, MongoLoggableComponent, SeverityLevel } from '../../mongodb';

describe('Feature Flags', () => {
describe('@@mdb.skipPingOnConnect', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/node-specific/ipv6.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as net from 'net';
import * as process from 'process';
import * as sinon from 'sinon';

import { ConnectionCreatedEvent, MongoClient, ReadPreference, TopologyType } from '../../../src';
import { ConnectionCreatedEvent, MongoClient, ReadPreference, TopologyType } from '../../mongodb';

describe('IPv6 Addresses', () => {
let client: MongoClient;
Expand Down
Loading