As33
@periodic/
arsenic
deprecated_api
⚠️ Warning

Query used deprecated database methods

Deprecated database API detected. May cause compatibility issues in future database versions and often indicates missed migration opportunities.

Common Causes

  • Using deprecated ORM methods
  • Legacy query patterns not updated
  • Old driver API versions

How to Fix

  1. 1.Update to current API per migration guide
  2. 2.Check changelog for replacement methods
  3. 3.Test thoroughly after migration

Example

typescript
// BAD — deprecated MongoDB method
await collection.count({ active: true }); // deprecated

// GOOD — current equivalent
await collection.countDocuments({ active: true });

Check your driver version

Deprecated APIs often still work for years but break on major version bumps. Fix them before upgrading your database driver, not after.

Common Mongoose deprecations

typescript
// BAD — deprecated methods
await Model.count({ active: true });          // use countDocuments()
await Model.findById(id).exec();             // .exec() optional since Mongoose 7
mongoose.connect(uri, { useNewUrlParser: true }); // options removed in Mongoose 7

// GOOD
await Model.countDocuments({ active: true });
await Model.findById(id);
mongoose.connect(uri);