Database no longer supports callbacks
Breaking change notice
Itential Platform 2023.2 introduces a breaking change in which the MongoDB Node Driver version no longer supports callbacks.
Global database change
Itential has upgraded the MongoDB Node Driver version used in the global database variable available to custom applications and adapters. The new version no longer supports callbacks — it uses a Promise-only API. All other arguments (filters, updates, options, etc.) remain unchanged. Previously, the last argument of all database operations accepted a callback function that was invoked when the operation completed.
What should I do?
The following example shows a callback-based operation using the global database variable. Callback functions used an “error-first” syntax, where any error was returned as the first argument and the result of a successful operation as the second:
There are two approaches for migrating to the Promise-based API:
Option 1: Use then() and catch()
Chain .then() and .catch() methods on the returned Promise. Each takes a function executed on success or failure:
Option 2: Use async/await
Define the method as async and await the Promise. This produces a flatter, simpler syntax. If a Promise is awaited, it returns the successful result or throws an error if the Promise rejects:
If you experience any issues or need assistance with your migration, contact the Product Support Team.