Custom Database Mongo Error "Unsupported OP_QUERY command"

Last Updated: Aug 20, 2024

Overview

Custom DB with Mongo template returns the following error:

Unsupported OP_QUERY command: find. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal

Applies To

  • Custom Database
  • Mongo templates

Cause

The Mongo package on the Custom DB template is outdated.

Solution

  1. Find the latest mongodb package version available here.
  2. Navigate to the custom database and go to the tab called “Custom Database”. There should be the database scripts.
  3. Set the MongoDB package version to the version we found above. Example:

    const MongoClient = require(‘mongodb@5.1.0’).MongoClient;

1 Like