- Relicense under the Apache-2.0 license.
- A new config option
config.protocol
which allows connections to replicateSets usingmongodb+srv
. This option will likely be removed in a future breaking release along with other parameterized values for the connection URL. Instead, the expectation is that only a fullurl
will be supported.
- Throw if
config.port
is invalid. - Ignore
config.port
if it'sundefined
ornull
.
- Github Actions now test on authenticated & unauthenticated databases.
openDatabase
pings server on successful connect.
- No longer pass in
authSource: undefined
as this causes connection strings with auth to fail. - No longer pass in
ssl: undefined
inconnectOptions
. openDatabase
now queries forserverInfo
first.openDatabase
now correctly checks if auth is needed.openDatabase
no longer logs in authenticated users twice.socketOptions
are now set correctly inconnectOptions
.- Use
db.databaseName
when logging connection success overconfig.name
.
- BREAKING: Require
@bedrock/core@6
peer dep.
- BREAKING: Remove option to create a user via command line prompt. This mechanism is very old and is not a recommended way (and is no longer supported) to configure or setup a modern bedrock application.
- Use
jsdoc-to-markdown@7
.
- BREAKING: Rename package to
@bedrock/mongodb
. - BREAKING: Convert to module (ESM).
- BREAKING: Remove default export.
- BREAKING: Require node 14.x.
- BREAKING: Remove all callback-variants of APIs.
- Update peer deps:
bedrock@4.5
.
- Update internals to use esm style and use
esm.js
to transpile to CommonJS.
- Properly handle the return value from the
_loginUser
helper function.
- Update peer dependencies; use bedrock@4.
- Removed unused
distributedId
collection. This collection has not been used sinceidGenerator
was removed in 7.x (which was the only feature that used it and it should have been removed at that time). - Removed
async
lib and replaced internal callback code with async/await code. This should be a non-breaking, non-additive change, but in the event that something new has been added, a minor release will be made.
- Deprecated
config.mongodb.options
. - Calls on
w
,j
,wtimeout
, andfsync
.
- Support for mongodb's new
writeConcern
option. - Deprecation notice to
api.writeOptions
.
- Return early in openCollections API to avoid unnecessary logging.
- Support promises in public API calls
openCollections
andcreateIndexes
.
- Log sanitized
config.url
.
- Use database sepecified in the connect string.
- Replace deprecated collection.s.{name, namespace} with mongo 3.5 properties.
- Add new debug mode to test project.
- Make handling of binary fields consistent across Mongo APIs by setting
promoteBuffers: true
in the clientconnectOptions
.
- BREAKING: Removed support for localCollections.
_createUser
now works with mongoDB node driver 3.5.- Removed
_addLocalUser
(_createUser
can now handle this). - Removed local config options from
config.js
. - Throw if the MongoDB serverVersion is less than 2.6.
- Prompt admin for
authSource
in the adminPrompt.
- Add a check to ensure connection errors are passed to the callback.
- Added an auth object to connectOptions if config.username & password are set.
- Added a
useNewUrlParser
option to config.
- BREAKING: Update to
mongodb
3.5 node driver. - BREAKING: Set default server version requirement to ">=4.2".
- This requirement can be adjusted with the
config.mongodb.requirements.serverVersion
config value.
- This requirement can be adjusted with the
- GitHub actions now tests Node.js versions 10, 12, and 14.
- GitHub actions now tests mongodb version 4.2.
- BREAKING autoReconnect is now
false
and should not betrue
. runOnceAsync
has been changed torunOnce
.- Db no longer contains methods that are Mongo 3.5 client specific.
- Client now refers to a Mongo 3.5 client with an updated API.
- Methods that now require
null
then callback have been set. - GridFSBucket now takes a Mongo 3.5 Db instance.
insert
has been changed toinsertOne
.isDatabaseError
looks for a variety of Mongo Errors now._openDatabase
returns an object with a client and a db.localClient.close
has been replaced withdb.close
.- Calls to login for authentication have been updated.
bedrock
peerDependency has been updated to^3.1.1
.
useUnifiedTopology
is nowtrue
and relevant settings have been added for it.forceServerObjectId
is now set and istrue
by default.- Tests for
openCollection
. - Tests for
createIndex
. - Tests for
collections
. test.config.js
now usesforceAuthentication
with a username and password.
- BREAKING:
lib/migrations.js
has been removed. - BREAKING:
lib/idGenerator.js
has been removed.
- Update max bedrock dependency to 3.x.
- Update to latest bedrock events API.
- Update to latest bedrock runOnce API.
- Using deprecated runOnceAsync for bedrock@1 compatibility.
- BREAKING: The
hash
API now uses Node crypto's SHA256 implementation. This eliminates thesodium-native
native dependency. Developers should use the v6 release on new projects or projects with no persistent data. Hashes on existing data generated with v5 are not compatible and there is no upgrade mechanism.
- Replace unmaintained
chloride
module withsodium-native
.
- Rollback callbackify createIndexes due to incompatibilities with
async.waterfall
.
- callbackify createIndexes API and add validation on options parameter.
- Add
createGridFSBucket
API.
- Handle duplicate distributed ID keys on init.
- Use
chloride
to provide blake2b implementation; it is a faster and better maintained implementation.
- Ability to check the server version via the semver-style version string
located in the
bedrock.config.mongodb.requirements.serverVersion
config key.
- Fix release tag.
- BREAKING: Use 256-bit
blake2b
fordatabase.hash
.
- Fix calls to
logger.debug
.
- Remove erroneous passing of write options to collection creation.
- Fix index key pattern (use
1
nottrue
).
- Update Mongo DB driver to v2.2.x.
- Use ES6 syntax.
- Update
async
dependency to v2.x.
- Fix bug when checking config.mongodb.local.
- Replace deprecated MongoDB API
ensureIndex
withcreateIndex
.
- Skip more initialization when !config.local.enable.
- Additional logging and error wrappers.
- Auto-detection for mongoDB authentication and an override config flag.
- Add _migration API which can be used for document transformation.
- Ignore collection not found error when dropping collections.
- Recursively encode array elements when building a database update.
- Init errors now wrapped in a BedrockError.
- Handle new MongoDB driver db.authenticate errors. No longer returns an error code so also check for an error "message" field of "could not authenticate".
- Add
config.mongodb.local.enable
option to enable using a local database. Disabled by default. In a remote replicated database setup, the local database needs to actually be local. Running a full mongodb node is heavyweight for the purposes of this module. For the time being, if the local database is disabled, every startup of a process will get a new globalId. A future update will introduce a more lightweight localId storage option. - Update mongodb driver dependency.
- Ensure I/O events can be processed when waiting for ID components in ID generator to load.
- Ensure database is set when using a mongodb URL.
- Set proper defaults when parsing mongodb URL.
- Fix configuration typo.
- Add feature to allow mongodb
url
in configuration.
- Deprecate
mongodb.options
. - Replace deprecated
safe
mongodb option withw: 'majority'
. - Support only node >= 4.x.x.
- Update bedrock dependencies.
- Update deps for npm v3 compatibility.
- Support MongoDB >= 3.0.
- Add authentication config option.
- Removed support for MongoDB 2.4 from the README, but no technical change prohibits its use.
- Do not use deprecated native BSON parser by default.
- Fix duplicate key error when adding users to the local collection in MongoDB 2.4.
- See git history for changes.