From ae6a55b919abe9f146c26d7c830026606fbdbe3f Mon Sep 17 00:00:00 2001 From: evanchooly Date: Sat, 8 Jun 2024 01:51:57 -0400 Subject: [PATCH] WIP --- .../dev/morphia/audits/BaseAuditTest.kt | 38 +++++ .../dev/morphia/audits/QueryAuditTest.kt | 11 ++ docs/modules/ROOT/pages/query-filters.adoc | 153 ++++++++++++++++++ 3 files changed, 202 insertions(+) create mode 100644 audits/src/test/kotlin/dev/morphia/audits/BaseAuditTest.kt create mode 100644 audits/src/test/kotlin/dev/morphia/audits/QueryAuditTest.kt create mode 100644 docs/modules/ROOT/pages/query-filters.adoc diff --git a/audits/src/test/kotlin/dev/morphia/audits/BaseAuditTest.kt b/audits/src/test/kotlin/dev/morphia/audits/BaseAuditTest.kt new file mode 100644 index 00000000000..2c214352cb9 --- /dev/null +++ b/audits/src/test/kotlin/dev/morphia/audits/BaseAuditTest.kt @@ -0,0 +1,38 @@ +package dev.morphia.audits + +import dev.morphia.audits.model.Results +import java.io.File +import org.testng.Assert.assertEquals +import org.testng.Assert.assertTrue + +open class BaseAuditTest { + protected fun validate(results: Results) { + assertEquals( + results.created.size, + 0, + "All existing operators should be represented: " + + results.created.joinToString("\n\t", prefix = "\n\t") { it.operator } + ) + assertEquals( + results.noExamples.size, + 0, + "All existing operators should have examples: " + + results.noExamples.joinToString("\n\t", prefix = "\n\t") { + "${it.operator}: ${it.name}" + } + ) + assertEquals( + results.noTest.size, + 0, + "All existing operators should have test cases: " + + results.noTest.joinToString("\n\t", prefix = "\n\t") { + "${it.operator}: ${it.testSource.relativeTo(File("../").absoluteFile)}" + } + ) + val noTags = results.noServerRelease.joinToString("\n", "\n") + assertTrue( + noTags.trim().isEmpty(), + "Some operators are missing server release tags: ${noTags}" + ) + } +} diff --git a/audits/src/test/kotlin/dev/morphia/audits/QueryAuditTest.kt b/audits/src/test/kotlin/dev/morphia/audits/QueryAuditTest.kt new file mode 100644 index 00000000000..5c0fb290b9b --- /dev/null +++ b/audits/src/test/kotlin/dev/morphia/audits/QueryAuditTest.kt @@ -0,0 +1,11 @@ +package dev.morphia.audits + +import dev.morphia.audits.model.OperatorType.FILTER +import org.testng.annotations.Test + +class QueryAuditTest : BaseAuditTest() { + @Test + fun filters() { + validate(RstAuditor.audit(FILTER)) + } +} diff --git a/docs/modules/ROOT/pages/query-filters.adoc b/docs/modules/ROOT/pages/query-filters.adoc new file mode 100644 index 00000000000..798c7cdcc80 --- /dev/null +++ b/docs/modules/ROOT/pages/query-filters.adoc @@ -0,0 +1,153 @@ +[%header,cols="1,2"] +|=== +|Operator|Docs + +| http://docs.mongodb.org/manual/reference/operator/query/all[$all] +| link:javadoc/dev/morphia/query/filters/Filters.html#all(java.lang.String,java.lang.Object)[Filters#all(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/and[$and] +| link:javadoc/dev/morphia/query/filters/Filters.html#and(dev.morphia.query.filters.Filter%2E%2E%2E)[Filters#and(Filter...)] + +| http://docs.mongodb.org/manual/reference/operator/query/bitsAllClear[$bitsAllClear] +a| + + * link:javadoc/dev/morphia/query/filters/Filters.html#bitsAllClear(java.lang.String,int)[Filters#bitsAllClear(String,int)] + * link:javadoc/dev/morphia/query/filters/Filters.html#bitsAllClear(java.lang.String,int)[Filters#bitsAllClear(String,int)] + + +| http://docs.mongodb.org/manual/reference/operator/query/bitsAllSet[$bitsAllSet] +a| + + * link:javadoc/dev/morphia/query/filters/Filters.html#bitsAllSet(java.lang.String,int)[Filters#bitsAllSet(String,int)] + * link:javadoc/dev/morphia/query/filters/Filters.html#bitsAllSet(java.lang.String,int)[Filters#bitsAllSet(String,int)] + + +| http://docs.mongodb.org/manual/reference/operator/query/bitsAnyClear[$bitsAnyClear] +| link:javadoc/dev/morphia/query/filters/Filters.html#bitsAnyClear(java.lang.String,java.lang.Object)[Filters#bitsAnyClear(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/bitsAnySet[$bitsAnySet] +| link:javadoc/dev/morphia/query/filters/Filters.html#bitsAnySet(java.lang.String,java.lang.Object)[Filters#bitsAnySet(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/box[$box] +| link:javadoc/dev/morphia/query/filters/Filters.html#box(java.lang.String,com.mongodb.client.model.geojson.Point,com.mongodb.client.model.geojson.Point)[Filters#box(String,Point,Point)] + +| http://docs.mongodb.org/manual/reference/operator/query/center[$center] +| link:javadoc/dev/morphia/query/filters/Filters.html#center(java.lang.String,com.mongodb.client.model.geojson.Point,double)[Filters#center(String,Point,double)] + +| http://docs.mongodb.org/manual/reference/operator/query/centerSphere[$centerSphere] +| link:javadoc/dev/morphia/query/filters/Filters.html#centerSphere(java.lang.String,com.mongodb.client.model.geojson.Point,double)[Filters#centerSphere(String,Point,double)] + +| http://docs.mongodb.org/manual/reference/operator/query/comment[$comment] +| link:javadoc/dev/morphia/query/filters/Filters.html#comment(java.lang.String,java.lang.Object)[Filters#comment(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/elemMatch[$elemMatch] +| link:javadoc/dev/morphia/query/filters/Filters.html#elemMatch(java.lang.String,dev.morphia.query.filters.Filter%2E%2E%2E)[Filters#elemMatch(String,Filter...)] + +| http://docs.mongodb.org/manual/reference/operator/query/eq[$eq] +| link:javadoc/dev/morphia/query/filters/Filters.html#eq(java.lang.String,java.lang.Object)[Filters#eq(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/exists[$exists] +| link:javadoc/dev/morphia/query/filters/Filters.html#exists(java.lang.String)[Filters#exists(String)] + +| http://docs.mongodb.org/manual/reference/operator/query/expr[$expr] +| link:javadoc/dev/morphia/query/filters/Filters.html#expr(dev.morphia.aggregation.expressions.impls.Expression)[Filters#expr(Expression)] + +| http://docs.mongodb.org/manual/reference/operator/query/geoIntersects[$geoIntersects] +| link:javadoc/dev/morphia/query/filters/Filters.html#geoIntersects(java.lang.String,com.mongodb.client.model.geojson.Geometry)[Filters#geoIntersects(String,Geometry)] + +| http://docs.mongodb.org/manual/reference/operator/query/geoWithin[$geoWithin] +a| + + * link:javadoc/dev/morphia/query/filters/Filters.html#geoWithin(java.lang.String,com.mongodb.client.model.geojson.Polygon)[Filters#geoWithin(String,Polygon)] + * link:javadoc/dev/morphia/query/filters/Filters.html#geoWithin(java.lang.String,com.mongodb.client.model.geojson.MultiPolygon)[Filters#geoWithin(String,MultiPolygon)] + + +| http://docs.mongodb.org/manual/reference/operator/query/geometry[$geometry] +| link:javadoc/dev/morphia/query/filters/Filters.html#geometry(java.lang.String,java.lang.Object)[Filters#geometry(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/gt[$gt] +| link:javadoc/dev/morphia/query/filters/Filters.html#gt(java.lang.String,java.lang.Object)[Filters#gt(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/gte[$gte] +| link:javadoc/dev/morphia/query/filters/Filters.html#gte(java.lang.String,java.lang.Object)[Filters#gte(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/in[$in] +| link:javadoc/dev/morphia/query/filters/Filters.html#in(java.lang.String,java.lang.Iterable)[Filters#in(String,Iterable)] + +| http://docs.mongodb.org/manual/reference/operator/query/jsonSchema[$jsonSchema] +| link:javadoc/dev/morphia/query/filters/Filters.html#jsonSchema(org.bson.Document)[Filters#jsonSchema(Document)] + +| http://docs.mongodb.org/manual/reference/operator/query/lt[$lt] +| link:javadoc/dev/morphia/query/filters/Filters.html#lt(java.lang.String,java.lang.Object)[Filters#lt(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/lte[$lte] +| link:javadoc/dev/morphia/query/filters/Filters.html#lte(java.lang.String,java.lang.Object)[Filters#lte(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/maxDistance[$maxDistance] +| link:javadoc/dev/morphia/query/filters/Filters.html#maxDistance(java.lang.String,java.lang.Object)[Filters#maxDistance(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/meta[$meta] +a| + + * link:javadoc/dev/morphia/query/Meta.html#indexKey(java.lang.String)[Meta#indexKey(String)] + * link:javadoc/dev/morphia/query/Meta.html#searchHighlights(java.lang.String)[Meta#searchHighlights(String)] + * link:javadoc/dev/morphia/query/Meta.html#searchScore(java.lang.String)[Meta#searchScore(String)] + * link:javadoc/dev/morphia/query/Meta.html#textScore(java.lang.String)[Meta#textScore(String)] + + +| http://docs.mongodb.org/manual/reference/operator/query/minDistance[$minDistance] +| link:javadoc/dev/morphia/query/filters/Filters.html#minDistance(java.lang.String,java.lang.Object)[Filters#minDistance(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/mod[$mod] +| link:javadoc/dev/morphia/query/filters/Filters.html#mod(java.lang.String,long,long)[Filters#mod(String,long,long)] + +| http://docs.mongodb.org/manual/reference/operator/query/ne[$ne] +| link:javadoc/dev/morphia/query/filters/Filters.html#ne(java.lang.String,java.lang.Object)[Filters#ne(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/near[$near] +| link:javadoc/dev/morphia/query/filters/Filters.html#near(java.lang.String,com.mongodb.client.model.geojson.Point)[Filters#near(String,Point)] + +| http://docs.mongodb.org/manual/reference/operator/query/nearSphere[$nearSphere] +| link:javadoc/dev/morphia/query/filters/Filters.html#nearSphere(java.lang.String,com.mongodb.client.model.geojson.Point)[Filters#nearSphere(String,Point)] + +| http://docs.mongodb.org/manual/reference/operator/query/nin[$nin] +| link:javadoc/dev/morphia/query/filters/Filters.html#nin(java.lang.String,java.lang.Object)[Filters#nin(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/nor[$nor] +| link:javadoc/dev/morphia/query/filters/Filters.html#nor(dev.morphia.query.filters.Filter%2E%2E%2E)[Filters#nor(Filter...)] + +| http://docs.mongodb.org/manual/reference/operator/query/not[$not] +| link:javadoc/dev/morphia/query/filters/Filter.html#not()[Filter#not()] + +| http://docs.mongodb.org/manual/reference/operator/query/or[$or] +| link:javadoc/dev/morphia/query/filters/Filters.html#or(dev.morphia.query.filters.Filter%2E%2E%2E)[Filters#or(Filter...)] + +| http://docs.mongodb.org/manual/reference/operator/query/polygon[$polygon] +| link:javadoc/dev/morphia/query/filters/Filters.html#polygon(java.lang.String,com.mongodb.client.model.geojson.Point%2E%2E%2E)[Filters#polygon(String,Point...)] + +| http://docs.mongodb.org/manual/reference/operator/query/regex[$regex] +a| + + * link:javadoc/dev/morphia/query/filters/Filters.html#regex(java.lang.String,java.lang.String)[Filters#regex(String,String)] + * link:javadoc/dev/morphia/query/filters/Filters.html#regex(java.lang.String,java.util.regex.Pattern)[Filters#regex(String,Pattern)] + + +| http://docs.mongodb.org/manual/reference/operator/query/size[$size] +| link:javadoc/dev/morphia/query/filters/Filters.html#size(java.lang.String,int)[Filters#size(String,int)] + +| http://docs.mongodb.org/manual/reference/operator/query/slice[$slice] +| link:javadoc/dev/morphia/query/ArraySlice.html#limit(int)[ArraySlice#limit(int)] + +| http://docs.mongodb.org/manual/reference/operator/query/text[$text] +| link:javadoc/dev/morphia/query/filters/Filters.html#text(java.lang.String)[Filters#text(String)] + +| http://docs.mongodb.org/manual/reference/operator/query/type[$type] +| link:javadoc/dev/morphia/query/filters/Filters.html#type(java.lang.String,dev.morphia.query.Type)[Filters#type(String,Type)] + +| http://docs.mongodb.org/manual/reference/operator/query/uniqueDocs[$uniqueDocs] +| link:javadoc/dev/morphia/query/filters/Filters.html#uniqueDocs(java.lang.String,java.lang.Object)[Filters#uniqueDocs(String,Object)] + +| http://docs.mongodb.org/manual/reference/operator/query/where[$where] +| link:javadoc/dev/morphia/query/filters/Filters.html#where(java.lang.String)[Filters#where(String)] + +|===