Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use the mql model instead of BSON for our own queries INTELLIJ-206 #138

Merged
merged 35 commits into from
Feb 7, 2025

Conversation

kmruiz
Copy link
Contributor

@kmruiz kmruiz commented Feb 4, 2025

This PR removes the usage of BSON for specifying queries and their return values and uses the MQL model instead. This has the benefit of removing one dependency from our projects and also aligns all our queries to use a single semantic model. It replaces all calls in the MongoDbDriver, but runCommand, with a new method called runQuery.

This PR doesn't remove runCommand because it depends on INTELLIJ-207.

Description

Checklist

Open Questions

@github-actions github-actions bot added the no release notes It's a chore and doesn't require release notes. label Feb 4, 2025
@github-actions github-actions bot added no release notes It's a chore and doesn't require release notes. and removed no release notes It's a chore and doesn't require release notes. labels Feb 4, 2025
if (doc is Map<*, *>) {
val mappings = doc.map { (key, value) ->
when (key) {
"${'$'}binary" -> null
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not implementing mappings that we don't support in our BSON Types because we can't do anything with them. So just skip them and we can add support later whenever we need them.

@@ -94,6 +94,10 @@ data class Node<S>(
*/
fun copy(componentModifier: (component: Component) -> Component): Node<S> =
copy(source = source, components = components.map(componentModifier))

override fun toString(): String {
return "Node(components=$components)"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found that toString was serializing the source, which in IntelliJ is the PSIElement and that required readAccess. It doesn't make sense as we are not using the source for anything here, so I'm removing it from the toString.

Copy link

github-actions bot commented Feb 4, 2025

Coverage Report

Overall Project 79.56% -0.74%
Files changed 83.21%

File Coverage
HasCollectionReference.kt 100%
HasExplain.kt 100%
BuildInfo.kt 96.56% -0.29%
DataGripBasedReadModelProvider.kt 95.02% -4.98%
HasValueReference.kt 93.02%
GetCollectionSchema.kt 92.88%
ListCollections.kt 92.81%
MongoshDialectFormatter.kt 90.86% -5.51%
Sort.kt 90.6%
Aggregate.kt 89.5%
Node.kt 89.3%
IndexCheckInspectionBridge.kt 88.63% -0.67%
DataGripMongoDbDriver.kt 86.85% -8.61%
HasFieldReference.kt 84.03% -4.86% 🚫
Limit.kt 83.54% -16.46%
BsonType.kt 82.32% -1.45% 🚫
MongoshBackend.kt 79.55% -1.74%
ExplainQuery.kt 78.68% -18.01%
MongoDbDriver.kt 67.74% -32.26% 🚫
RunQueryModal.kt 65.86% -0.6% 🚫
Query.kt 48.35% -41.76% 🚫
ListDatabases.kt 38.37% -9.3% 🚫

@github-actions github-actions bot added no release notes It's a chore and doesn't require release notes. and removed no release notes It's a chore and doesn't require release notes. labels Feb 4, 2025
@kmruiz kmruiz requested a review from himanshusinghs February 4, 2025 18:56
@github-actions github-actions bot added no release notes It's a chore and doesn't require release notes. and removed no release notes It's a chore and doesn't require release notes. labels Feb 4, 2025
@github-actions github-actions bot added no release notes It's a chore and doesn't require release notes. and removed no release notes It's a chore and doesn't require release notes. labels Feb 4, 2025
@github-actions github-actions bot added no release notes It's a chore and doesn't require release notes. and removed no release notes It's a chore and doesn't require release notes. labels Feb 6, 2025
@github-actions github-actions bot added no release notes It's a chore and doesn't require release notes. and removed no release notes It's a chore and doesn't require release notes. labels Feb 6, 2025
Copy link

github-actions bot commented Feb 6, 2025

🤖 Benchmark Comparison for chore: fix datagrip tests

Benchmark Previous Current Change
com.mongodb.jbplugin.jmh.SampleBenchmark.init 2,625,449,865.73 ops/s 2,608,169,485.11 ops/s -0.66%

@github-actions github-actions bot added no release notes It's a chore and doesn't require release notes. and removed no release notes It's a chore and doesn't require release notes. labels Feb 6, 2025
Copy link

github-actions bot commented Feb 6, 2025

🤖 Benchmark Comparison for Merge branch 'main' into chore/INTELLIJ-206

Benchmark Previous Current Change
com.mongodb.jbplugin.jmh.SampleBenchmark.init 2,625,449,865.73 ops/s 2,661,406,499.14 ops/s 1.37%

@github-actions github-actions bot added no release notes It's a chore and doesn't require release notes. and removed no release notes It's a chore and doesn't require release notes. labels Feb 6, 2025
Copy link

github-actions bot commented Feb 6, 2025

🤖 Benchmark Comparison for chore: clean up test deps

Benchmark Previous Current Change
com.mongodb.jbplugin.jmh.SampleBenchmark.init 2,611,710,046.52 ops/s 2,670,078,759.86 ops/s 2.23%

@github-actions github-actions bot added no release notes It's a chore and doesn't require release notes. and removed no release notes It's a chore and doesn't require release notes. labels Feb 6, 2025
Copy link

github-actions bot commented Feb 6, 2025

🤖 Benchmark Comparison for chore: add build.properties and fix test (idk why it doesn't load this file now from prod)

Benchmark Previous Current Change
com.mongodb.jbplugin.jmh.SampleBenchmark.init 2,611,710,046.52 ops/s 2,624,242,610.18 ops/s 0.48%

@github-actions github-actions bot added no release notes It's a chore and doesn't require release notes. and removed no release notes It's a chore and doesn't require release notes. labels Feb 6, 2025
Copy link

github-actions bot commented Feb 6, 2025

🤖 Benchmark Comparison for chore: fix test

Benchmark Previous Current Change
com.mongodb.jbplugin.jmh.SampleBenchmark.init 2,611,710,046.52 ops/s 2,661,282,200.18 ops/s 1.90%

@github-actions github-actions bot added no release notes It's a chore and doesn't require release notes. and removed no release notes It's a chore and doesn't require release notes. labels Feb 6, 2025
Copy link

github-actions bot commented Feb 6, 2025

🤖 Benchmark Comparison for chore: fix flaky test

Benchmark Previous Current Change
com.mongodb.jbplugin.jmh.SampleBenchmark.init 2,611,710,046.52 ops/s 2,631,314,070.68 ops/s 0.75%

@himanshusinghs himanshusinghs merged commit 555e379 into main Feb 7, 2025
12 checks passed
@himanshusinghs himanshusinghs deleted the chore/INTELLIJ-206 branch February 7, 2025 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no release notes It's a chore and doesn't require release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants