microsoft / microsoft/vscode-documentdb

Expert Query Support 🚀

Open
#64 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feedback wanted
Dominant language
TypeScript
Stars
31
Forks
22
Avg merge
2d 20h
Merged PRs (30d)
21

Description

Expert Query Support: Feedback and Collaboration Welcome! 🚀

Summary

The current Collection View supports only a simple find filter query. While this provides a basic interface for querying documents, it lacks flexibility and limits the user’s ability to refine or customize queries. This RFC proposes exploring and potentially implementing two scenarios to enhance query capabilities:

  1. Enhanced Entry-Level Mode: Extend the existing find filter by adding support for projection and sort fields.
  2. Expert Mode: Introduce a free-text query input with intellisense support, providing advanced users with a more flexible querying experience.

Details

Scenario 1: Enhanced Entry-Level Mode

The current query filter would be expanded to include:

  • Projection: Specify which fields to include or exclude in the output.
    • Example: { "name": 1, "age": 1 } to include only the name and age fields.
  • Sort: Define sorting for query results.
    • Example: { "age": -1 } to sort results by age in descending order.

This mode caters to users seeking simple but slightly more refined queries without overwhelming complexity.

Scenario 2: Expert Mode

Introduce an expert mode allowing free-text input for more advanced query construction. This would include:

  • Intellisense Support: Assist users with suggestions, syntax completion, and validation.
  • Advanced Query Features: Decide whether to limit inputs to the find syntax or support additional advanced query features such as:
    1. Aggregation Pipelines: Enabling transformations and complex queries in the same interface.
      • Example: { $match: { age: { $gt: 30 } } }, { $group: { _id: "$city", avgAge: { $avg: "$age" } } }
    2. Update Queries: Allowing modifications directly from the query view.
      • Example: { $set: { status: "active" } }

Discussion Areas

Complexity vs. Need
  • Simple Queries: The current focus of the Collection View is data exploration. Does adding advanced query capabilities dilute its purpose?
  • Advanced Queries: For complex operations, is it sufficient to rely on existing shell integration, which already supports full query syntax but lacks the user-friendly representation of the Collection View?
Integration of Advanced Features
  • Should the expert mode be limited to find syntax to maintain simplicity, or should it support a broader range of advanced query features?
  • What would be the key use cases for extending beyond find? For instance:
    • Aggregation pipelines for pre-processing data in view.
    • Update queries for making live changes during data exploration.
User Experience
  • How should the expert mode be presented? Would a toggle between "Basic" and "Expert" modes suffice?
  • Should query history and saved queries be part of this feature?

Argument Against Advanced Features

An argument against a more complex expert mode is the existing integration of shell support, which allows executing any query. However, the shell lacks the modern data representation and visualization provided by the Collection View. This raises the question:

  • Is there a need for advanced query capabilities within the Collection View, or should its purpose remain primarily data exploration?

Next Steps

  • Evaluate user demand for enhanced entry-level and expert modes through community feedback and usage patterns.
  • Prototype the two scenarios to assess feasibility and user experience:
    • Entry-level mode with projection and sort fields.
    • Expert mode with intellisense and free-text input for queries.
  • Define boundaries for the expert mode (e.g., find syntax only vs. advanced query features).
  • Compare against existing shell integration to determine overlap and necessity.

Conclusion

While the enhanced entry-level mode is a clear value-add for most users, the expert mode requires careful consideration of its scope and alignment with the Collection View's primary purpose: viewing and exploring data.

Feedback is welcome on:

  1. The need for advanced query capabilities in the Collection View.
  2. The balance between simplicity and flexibility in query construction.
  3. Whether to prioritize basic enhancements, expert mode, or both.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Collection View's existing find-filter implementation and compare its capabilities with the existing shell integration. The issue names no files or tests; done requires an agreed scope for projection and sort, expert-mode boundaries, and a feasibility prototype.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
database, devtools, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.