Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-95901

Testing mechanism to list available MQL stages, expressions, match expressions, etc.

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Query Language
    • None
    • Query Optimization

      MongoDB supports a listCommands command. It returns a list of the names of all the database commands supported by the system. This is useful primarily for testing. We often want to ensure that all commands have test coverage along a dimension. For example, auth/lib/commands_lib.js makes sure that we have basic access control test coverage for all commands. jstests/sharding/database_versioning_all_commands.js makes sure that all commands have the necessary test coverage for "database versioning", a detail of our shard versioning protocol. These tests can be written in such a way so that when a new command is implemented, the existing integration tests will fail unless a test case is added to cover the new command.

      This ticket suggests added a similar mechanism to list the libraries of primitives available in the MQL language. There are various types of MQL entities we should be able to list. The obvious ones that come to mind are:

      • Pipeline stages
      • Expressions
      • Match expressions
      • Accumulators
      • Window functions

      One possible implementation of this would be to add a new agg stage like $listMqlEntities, with some options to control which kinds of entities to list. As a starting point, we could just list names of stages, expressions, and so on, but in the future we could include any properties that we deem necessary for testing. We should make sure that $listMqlEntities is test-only and thus not exposed to customers.

      Credit to ryan.chipman@mongodb.com for proposing this idea!

            Assignee:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated: