Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-5725

Natural API for Describing Queries

    • Type: Icon: Epic Epic
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Query
    • None
    • To Do
    • Natural API for Describing Queries
    • 0
    • 0
    • 0
    • 100

      Summary

      The existing Criteria API is functional, and exposes plenty of helpers for operations like conjunction and disjunction, but it still requires the programmer to know MDB's underlying query language (e.g. the difference between 'foo', '$foo', and '$$foo' in any given context, and when to use aggregation operations versus query operations, and the sometimes-subtle differences there).

      Such distinctions can and should be minimized in the abstractions we present to the user.

      A minimal prototype is attached to this ticket, as an example of one proposed syntax and implementation.

      Motivation

      Who is the affected end user?

      The programmers who use Mongoid.

      How does this affect the end user?

      This will make it easier for developers new to MongoDB to learn how to query the database, allowing them to lean on their existing knowledge of Ruby's logical operators and syntax.

      How likely is it that this problem or use case will occur?

      Any time a programmer needs to issue a query (and especially when dealing with aggregation pipelines), they need to know how to differentiate between the different query contexts and the special syntax used to identify fields versus literals versus variables.

      If the problem does occur, what are the consequences and how severe are they?

      Any time a programmer needs to stop and look up the documentation for MongoDB syntax, they're taken out of the flow. This is an annoyance, and a time sink, and is additional friction that can discourage programmers from wanting to investigate and use MongoDB.

      Is this issue urgent?

      There are no prior dependencies to be met for this. Nothing is blocked. It's primarily a developer-experience improvement, but one that has the potential to polish some rough corners that might otherwise discourage people from using MongoDB.

      Is this ticket required by a downstream team?

      No.

      Is this ticket only for tests?

      No.

      Cast of Characters

      Engineering Lead:
      Document Author:
      POCers:
      Product Owner:
      Program Manager:
      Stakeholders:

      Channels & Docs

      Slack Channel

      [Scope Document|some.url]

      [Technical Design Document|some.url]

            Assignee:
            Unassigned Unassigned
            Reporter:
            jamis.buck@mongodb.com Jamis Buck
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: