Skip to content

Commit 770a7e2

Browse files
feat: add time-series operators to syntax highlighting VSCODE-266 (#307)
* feat: add time-series operators to syntax highlighting VSCODE-266 * build: use npm 7 * build: use fresh package lock
1 parent fc18e43 commit 770a7e2

File tree

4 files changed

+195
-19
lines changed

4 files changed

+195
-19
lines changed

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"engines": {
6262
"vscode": "^1.49.0",
6363
"node": "^12.4.0",
64-
"npm": ">=6.13.0"
64+
"npm": "^7.19.0"
6565
},
6666
"activationEvents": [
6767
"onCommand:mdb.connect",
@@ -942,7 +942,7 @@
942942
"mocha": "^8.2.1",
943943
"mocha-junit-reporter": "^2.0.0",
944944
"mocha-multi": "^1.1.3",
945-
"mongodb-ace-autocompleter": "^0.4.14",
945+
"mongodb-ace-autocompleter": "^0.6.0",
946946
"mongodb-build-info": "^1.1.1",
947947
"mongodb-runner": "^4.8.3",
948948
"node-loader": "^0.6.0",

snippets/stage-autocompleter.json

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,22 @@
9999
"prefix": "$geoNear",
100100
"body": [
101101
"/**",
102-
" * options: The geo query options.",
103-
" */",
102+
" * near: The point to search near.",
103+
" * distanceField: The calculated distance.",
104+
" * maxDistance: The maximum distance, in meters, documents can be before being excluded from results.",
105+
" * query: Limits results that match the query",
106+
" * includeLocs: Optional. Labels and includes the point used to match the document.",
107+
" * num: Optional. The maximum number of documents to return.",
108+
" * spherical: Defaults to false. Specifies whether to use spherical geometry.",
109+
"}",
104110
"\\$geoNear: {",
105-
" near: The point to search near.",
106-
" distanceField: The calculated distance.",
107-
" maxDistance: The maximum distance, in meters, documents can be before being excluded from results.",
108-
" query: Limits results that match the query",
109-
" includeLocs: Optional. Labels and includes the point used to match the document.",
110-
" num: Optional. The maximum number of documents to return.",
111-
" spherical: Defaults to false. Specifies whether to use spherical geometry.",
111+
" near: { type: 'Point', coordinates: [ ${1:number}, ${2:number} ] },",
112+
" distanceField: '${3:string}',",
113+
" maxDistance: ${4:number},",
114+
" query: {${5}},",
115+
" includeLocs: '${6}',",
116+
" num: ${7:number},",
117+
" spherical: ${8:boolean}",
112118
"}"
113119
],
114120
"description": "Returns documents based on proximity to a geospatial point."
@@ -344,6 +350,41 @@
344350
],
345351
"description": "Adds new fields to documents. $set outputs documents that contain all existing fields from the input documents and newly added fields."
346352
},
353+
"MongoDB Aggregations $setWindowFields": {
354+
"prefix": "$setWindowFields",
355+
"body": [
356+
"/**",
357+
" * partitionBy: partitioning of data.",
358+
" * sortBy: fields to sort by.",
359+
" * output: {",
360+
" * path: {",
361+
" * function: The window function to compute over the given window.",
362+
" * window: {",
363+
" * documents: A number of documents before and after the current document.",
364+
" * range: A range of possible values around the value in the current document's sortBy field.",
365+
" * unit: Specifies the units for the window bounds.",
366+
" * }",
367+
" * }",
368+
" * }",
369+
" */",
370+
"\\$setWindowFields: {",
371+
" partitionBy: ${1:expression},",
372+
" sortBy: ${2:sortSpec},",
373+
" output: {",
374+
" ${3:path}: {",
375+
" ${4:function}: ${5:functionArgs},",
376+
" window: {",
377+
" documents: [${6:lowerBound}, ${7:upperBound}],",
378+
" range: [${8:lowerBound}, ${9:upperBound}],",
379+
" unit: ${10:string}",
380+
" }",
381+
" },",
382+
" ${11:path2}: ...",
383+
" }",
384+
"}"
385+
],
386+
"description": "Capable of partitioning incoming data, and can apply one or more functions to defined windows within each partition."
387+
},
347388
"MongoDB Aggregations $skip": {
348389
"prefix": "$skip",
349390
"body": [

syntaxes/mongodb.tmLanguage.json

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2704,6 +2704,15 @@
27042704
}
27052705
}
27062706
},
2707+
{
2708+
"name": "meta.object.member.mongodb",
2709+
"match": "\\$setWindowFields\\b",
2710+
"captures": {
2711+
"0": {
2712+
"name": "keyword.other.aggStageOperators.setWindowFields.mongodb"
2713+
}
2714+
}
2715+
},
27072716
{
27082717
"name": "meta.object.member.mongodb",
27092718
"match": "\\$sample\\b",
@@ -3766,6 +3775,15 @@
37663775
}
37673776
}
37683777
},
3778+
{
3779+
"name": "meta.object.member.mongodb",
3780+
"match": "\\$dateTrunc\\b",
3781+
"captures": {
3782+
"0": {
3783+
"name": "keyword.other.aggExpressionOperators.dateTrunc.mongodb"
3784+
}
3785+
}
3786+
},
37693787
{
37703788
"name": "meta.object.member.mongodb",
37713789
"match": "\\$dateToString\\b",
@@ -3784,6 +3802,15 @@
37843802
}
37853803
}
37863804
},
3805+
{
3806+
"name": "meta.object.member.mongodb",
3807+
"match": "\\$dateSubtract\\b",
3808+
"captures": {
3809+
"0": {
3810+
"name": "keyword.other.aggExpressionOperators.dateSubtract.mongodb"
3811+
}
3812+
}
3813+
},
37873814
{
37883815
"name": "meta.object.member.mongodb",
37893816
"match": "\\$dateFromString\\b",
@@ -3802,6 +3829,24 @@
38023829
}
38033830
}
38043831
},
3832+
{
3833+
"name": "meta.object.member.mongodb",
3834+
"match": "\\$dateDiff\\b",
3835+
"captures": {
3836+
"0": {
3837+
"name": "keyword.other.aggExpressionOperators.dateDiff.mongodb"
3838+
}
3839+
}
3840+
},
3841+
{
3842+
"name": "meta.object.member.mongodb",
3843+
"match": "\\$dateAdd\\b",
3844+
"captures": {
3845+
"0": {
3846+
"name": "keyword.other.aggExpressionOperators.dateAdd.mongodb"
3847+
}
3848+
}
3849+
},
38053850
{
38063851
"name": "meta.object.member.mongodb",
38073852
"match": "\\$cond\\b",
@@ -4027,6 +4072,15 @@
40274072
}
40284073
}
40294074
},
4075+
{
4076+
"name": "meta.object.member.mongodb",
4077+
"match": "\\$shift\\b",
4078+
"captures": {
4079+
"0": {
4080+
"name": "keyword.other.aggAccumulators.shift.mongodb"
4081+
}
4082+
}
4083+
},
40304084
{
40314085
"name": "meta.object.member.mongodb",
40324086
"match": "\\$stdDevSamp\\b",
@@ -4045,6 +4099,15 @@
40454099
}
40464100
}
40474101
},
4102+
{
4103+
"name": "meta.object.member.mongodb",
4104+
"match": "\\$rank\\b",
4105+
"captures": {
4106+
"0": {
4107+
"name": "keyword.other.aggAccumulators.rank.mongodb"
4108+
}
4109+
}
4110+
},
40484111
{
40494112
"name": "meta.object.member.mongodb",
40504113
"match": "\\$push\\b",
@@ -4081,6 +4144,15 @@
40814144
}
40824145
}
40834146
},
4147+
{
4148+
"name": "meta.object.member.mongodb",
4149+
"match": "\\$integral\\b",
4150+
"captures": {
4151+
"0": {
4152+
"name": "keyword.other.aggAccumulators.integral.mongodb"
4153+
}
4154+
}
4155+
},
40844156
{
40854157
"name": "meta.object.member.mongodb",
40864158
"match": "\\$first\\b",
@@ -4090,6 +4162,69 @@
40904162
}
40914163
}
40924164
},
4165+
{
4166+
"name": "meta.object.member.mongodb",
4167+
"match": "\\$expMovingAvg\\b",
4168+
"captures": {
4169+
"0": {
4170+
"name": "keyword.other.aggAccumulators.expMovingAvg.mongodb"
4171+
}
4172+
}
4173+
},
4174+
{
4175+
"name": "meta.object.member.mongodb",
4176+
"match": "\\$documentNumber\\b",
4177+
"captures": {
4178+
"0": {
4179+
"name": "keyword.other.aggAccumulators.documentNumber.mongodb"
4180+
}
4181+
}
4182+
},
4183+
{
4184+
"name": "meta.object.member.mongodb",
4185+
"match": "\\$denseRank\\b",
4186+
"captures": {
4187+
"0": {
4188+
"name": "keyword.other.aggAccumulators.denseRank.mongodb"
4189+
}
4190+
}
4191+
},
4192+
{
4193+
"name": "meta.object.member.mongodb",
4194+
"match": "\\$derivative\\b",
4195+
"captures": {
4196+
"0": {
4197+
"name": "keyword.other.aggAccumulators.derivative.mongodb"
4198+
}
4199+
}
4200+
},
4201+
{
4202+
"name": "meta.object.member.mongodb",
4203+
"match": "\\$count\\b",
4204+
"captures": {
4205+
"0": {
4206+
"name": "keyword.other.aggAccumulators.count.mongodb"
4207+
}
4208+
}
4209+
},
4210+
{
4211+
"name": "meta.object.member.mongodb",
4212+
"match": "\\$covarianceSamp\\b",
4213+
"captures": {
4214+
"0": {
4215+
"name": "keyword.other.aggAccumulators.covarianceSamp.mongodb"
4216+
}
4217+
}
4218+
},
4219+
{
4220+
"name": "meta.object.member.mongodb",
4221+
"match": "\\$covariancePop\\b",
4222+
"captures": {
4223+
"0": {
4224+
"name": "keyword.other.aggAccumulators.covariancePop.mongodb"
4225+
}
4226+
}
4227+
},
40934228
{
40944229
"name": "meta.object.member.mongodb",
40954230
"match": "\\$avg\\b",

0 commit comments

Comments
 (0)