@lowdefy/connection-mongodb 4.0.0-alpha.1 → 4.0.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/connections/MongoDBCollection/MongoDBAggregation/MongoDBAggregation.js +8 -2
  2. package/dist/connections/MongoDBCollection/MongoDBAggregation/schema.js +42 -0
  3. package/dist/connections/MongoDBCollection/MongoDBCollection.js +2 -3
  4. package/dist/connections/MongoDBCollection/MongoDBDeleteMany/MongoDBDeleteMany.js +10 -3
  5. package/dist/connections/MongoDBCollection/MongoDBDeleteMany/schema.js +42 -0
  6. package/dist/connections/MongoDBCollection/MongoDBDeleteOne/MongoDBDeleteOne.js +10 -3
  7. package/dist/connections/MongoDBCollection/MongoDBDeleteOne/schema.js +42 -0
  8. package/dist/connections/MongoDBCollection/MongoDBFind/MongoDBFind.js +8 -2
  9. package/dist/connections/MongoDBCollection/MongoDBFind/schema.js +42 -0
  10. package/dist/connections/MongoDBCollection/MongoDBFindOne/MongoDBFindOne.js +8 -2
  11. package/dist/connections/MongoDBCollection/MongoDBFindOne/schema.js +42 -0
  12. package/dist/connections/MongoDBCollection/MongoDBInsertMany/MongoDBInsertMany.js +11 -5
  13. package/dist/connections/MongoDBCollection/MongoDBInsertMany/schema.js +48 -0
  14. package/dist/connections/MongoDBCollection/MongoDBInsertOne/MongoDBInsertOne.js +11 -6
  15. package/dist/connections/MongoDBCollection/MongoDBInsertOne/schema.js +42 -0
  16. package/dist/connections/MongoDBCollection/MongoDBUpdateMany/MongoDBUpdateMany.js +8 -2
  17. package/dist/connections/MongoDBCollection/MongoDBUpdateMany/schema.js +56 -0
  18. package/dist/connections/MongoDBCollection/MongoDBUpdateOne/MongoDBUpdateOne.js +8 -2
  19. package/dist/connections/MongoDBCollection/MongoDBUpdateOne/schema.js +56 -0
  20. package/dist/connections/MongoDBCollection/schema.js +69 -0
  21. package/dist/connections/MongoDBCollection/serialize.js +4 -4
  22. package/dist/{connections/MongoDBCollection/MongoDBFind/index.js → connections.js} +1 -10
  23. package/dist/{connections/MongoDBCollection/MongoDBFindOne/index.js → types.js} +6 -10
  24. package/package.json +14 -13
  25. package/dist/connections/MongoDBCollection/MongoDBAggregation/MongoDBAggregationSchema.json +0 -26
  26. package/dist/connections/MongoDBCollection/MongoDBAggregation/index.js +0 -24
  27. package/dist/connections/MongoDBCollection/MongoDBCollectionSchema.json +0 -52
  28. package/dist/connections/MongoDBCollection/MongoDBDeleteMany/MongoDBDeleteManySchema.json +0 -26
  29. package/dist/connections/MongoDBCollection/MongoDBDeleteMany/index.js +0 -24
  30. package/dist/connections/MongoDBCollection/MongoDBDeleteOne/MongoDBDeleteOneSchema.json +0 -26
  31. package/dist/connections/MongoDBCollection/MongoDBDeleteOne/index.js +0 -24
  32. package/dist/connections/MongoDBCollection/MongoDBFind/MongoDBFindSchema.json +0 -26
  33. package/dist/connections/MongoDBCollection/MongoDBFindOne/MongoDBFindOneSchema.json +0 -26
  34. package/dist/connections/MongoDBCollection/MongoDBInsertMany/MongoDBInsertManySchema.json +0 -32
  35. package/dist/connections/MongoDBCollection/MongoDBInsertMany/index.js +0 -24
  36. package/dist/connections/MongoDBCollection/MongoDBInsertOne/MongoDBInsertOneSchema.json +0 -26
  37. package/dist/connections/MongoDBCollection/MongoDBInsertOne/index.js +0 -24
  38. package/dist/connections/MongoDBCollection/MongoDBUpdateMany/MongoDBUpdateManySchema.json +0 -36
  39. package/dist/connections/MongoDBCollection/MongoDBUpdateMany/index.js +0 -24
  40. package/dist/connections/MongoDBCollection/MongoDBUpdateOne/MongoDBUpdateOneSchema.json +0 -36
  41. package/dist/connections/MongoDBCollection/MongoDBUpdateOne/index.js +0 -24
  42. package/dist/index.js +0 -7
@@ -14,6 +14,7 @@
14
14
  limitations under the License.
15
15
  */ import getCollection from '../getCollection.js';
16
16
  import { serialize, deserialize } from '../serialize.js';
17
+ import schema from './schema.js';
17
18
  function checkOutAndMerge({ pipeline , connection }) {
18
19
  if (connection.write !== true) {
19
20
  pipeline.forEach((stage)=>{
@@ -23,7 +24,7 @@ function checkOutAndMerge({ pipeline , connection }) {
23
24
  });
24
25
  }
25
26
  }
26
- async function mongodbAggregation({ request , connection }) {
27
+ async function MongodbAggregation({ request , connection }) {
27
28
  const deserializedRequest = deserialize(request);
28
29
  const { pipeline , options } = deserializedRequest;
29
30
  checkOutAndMerge({
@@ -44,4 +45,9 @@ async function mongodbAggregation({ request , connection }) {
44
45
  await client.close();
45
46
  return serialize(res);
46
47
  }
47
- export default mongodbAggregation;
48
+ MongodbAggregation.schema = schema;
49
+ MongodbAggregation.meta = {
50
+ checkRead: true,
51
+ checkWrite: false
52
+ };
53
+ export default MongodbAggregation;
@@ -0,0 +1,42 @@
1
+ /*
2
+ Copyright 2020-2021 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Lowdefy Request Schema - MongoDBAggregation',
18
+ type: 'object',
19
+ required: [
20
+ 'pipeline'
21
+ ],
22
+ properties: {
23
+ pipeline: {
24
+ type: 'array',
25
+ description: 'Array containing all the aggregation framework commands for the execution.',
26
+ errorMessage: {
27
+ type: 'MongoDBAggregation request property "pipeline" should be an array.'
28
+ }
29
+ },
30
+ options: {
31
+ type: 'object',
32
+ description: 'Optional settings.',
33
+ errorMessage: {
34
+ type: 'MongoDBAggregation request property "options" should be an object.'
35
+ }
36
+ }
37
+ },
38
+ errorMessage: {
39
+ type: 'MongoDBAggregation request properties should be an object.',
40
+ required: 'MongoDBAggregation request should have required property "pipeline".'
41
+ }
42
+ };
@@ -21,10 +21,9 @@ import MongoDBInsertMany from './MongoDBInsertMany/MongoDBInsertMany.js';
21
21
  import MongoDBInsertOne from './MongoDBInsertOne/MongoDBInsertOne.js';
22
22
  import MongoDBUpdateMany from './MongoDBUpdateMany/MongoDBUpdateMany.js';
23
23
  import MongoDBUpdateOne from './MongoDBUpdateOne/MongoDBUpdateOne.js';
24
+ import schema from './schema.js';
24
25
  export default {
25
- import: {
26
- schema: 'connections/MongoDBCollection/MongoDBCollectionSchema.json'
27
- },
26
+ schema,
28
27
  requests: {
29
28
  MongoDBAggregation,
30
29
  MongoDBDeleteMany,
@@ -14,7 +14,8 @@
14
14
  limitations under the License.
15
15
  */ import getCollection from '../getCollection.js';
16
16
  import { serialize, deserialize } from '../serialize.js';
17
- async function mongodbDeleteMany({ request , connection }) {
17
+ import schema from './schema.js';
18
+ async function MongodbDeleteMany({ request , connection }) {
18
19
  const deserializedRequest = deserialize(request);
19
20
  const { filter , options } = deserializedRequest;
20
21
  const { collection , client } = await getCollection({
@@ -28,9 +29,15 @@ async function mongodbDeleteMany({ request , connection }) {
28
29
  throw error;
29
30
  }
30
31
  await client.close();
31
- const { deletedCount } = serialize(res);
32
+ const { acknowledged , deletedCount } = serialize(res);
32
33
  return {
34
+ acknowledged,
33
35
  deletedCount
34
36
  };
35
37
  }
36
- export default mongodbDeleteMany;
38
+ MongodbDeleteMany.schema = schema;
39
+ MongodbDeleteMany.meta = {
40
+ checkRead: false,
41
+ checkWrite: true
42
+ };
43
+ export default MongodbDeleteMany;
@@ -0,0 +1,42 @@
1
+ /*
2
+ Copyright 2020-2021 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Lowdefy Request Schema - MongoDBDeleteMany',
18
+ type: 'object',
19
+ required: [
20
+ 'filter'
21
+ ],
22
+ properties: {
23
+ filter: {
24
+ type: 'object',
25
+ description: 'The filter used to select the document to update.',
26
+ errorMessage: {
27
+ type: 'MongoDBDeleteMany request property "filter" should be an object.'
28
+ }
29
+ },
30
+ options: {
31
+ type: 'object',
32
+ description: 'Optional settings.',
33
+ errorMessage: {
34
+ type: 'MongoDBDeleteMany request property "options" should be an object.'
35
+ }
36
+ }
37
+ },
38
+ errorMessage: {
39
+ type: 'MongoDBDeleteMany request properties should be an object.',
40
+ required: 'MongoDBDeleteMany request should have required property "filter".'
41
+ }
42
+ };
@@ -14,7 +14,8 @@
14
14
  limitations under the License.
15
15
  */ import getCollection from '../getCollection.js';
16
16
  import { serialize, deserialize } from '../serialize.js';
17
- async function mongodbDeleteOne({ request , connection }) {
17
+ import schema from './schema.js';
18
+ async function MongodbDeleteOne({ request , connection }) {
18
19
  const deserializedRequest = deserialize(request);
19
20
  const { filter , options } = deserializedRequest;
20
21
  const { collection , client } = await getCollection({
@@ -28,9 +29,15 @@ async function mongodbDeleteOne({ request , connection }) {
28
29
  throw error;
29
30
  }
30
31
  await client.close();
31
- const { deletedCount } = serialize(res);
32
+ const { acknowledged , deletedCount } = serialize(res);
32
33
  return {
34
+ acknowledged,
33
35
  deletedCount
34
36
  };
35
37
  }
36
- export default mongodbDeleteOne;
38
+ MongodbDeleteOne.schema = schema;
39
+ MongodbDeleteOne.meta = {
40
+ checkRead: false,
41
+ checkWrite: true
42
+ };
43
+ export default MongodbDeleteOne;
@@ -0,0 +1,42 @@
1
+ /*
2
+ Copyright 2020-2021 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Lowdefy Request Schema - MongoDBDeleteOne',
18
+ type: 'object',
19
+ required: [
20
+ 'filter'
21
+ ],
22
+ properties: {
23
+ filter: {
24
+ type: 'object',
25
+ description: 'The filter used to select the document to update.',
26
+ errorMessage: {
27
+ type: 'MongoDBDeleteOne request property "filter" should be an object.'
28
+ }
29
+ },
30
+ options: {
31
+ type: 'object',
32
+ description: 'Optional settings.',
33
+ errorMessage: {
34
+ type: 'MongoDBDeleteOne request property "options" should be an object.'
35
+ }
36
+ }
37
+ },
38
+ errorMessage: {
39
+ type: 'MongoDBDeleteOne request properties should be an object.',
40
+ required: 'MongoDBDeleteOne request should have required property "filter".'
41
+ }
42
+ };
@@ -14,7 +14,8 @@
14
14
  limitations under the License.
15
15
  */ import getCollection from '../getCollection.js';
16
16
  import { serialize, deserialize } from '../serialize.js';
17
- async function mongodbFind({ request , connection }) {
17
+ import schema from './schema.js';
18
+ async function MongodbFind({ request , connection }) {
18
19
  const deserializedRequest = deserialize(request);
19
20
  const { query , options } = deserializedRequest;
20
21
  const { collection , client } = await getCollection({
@@ -31,4 +32,9 @@ async function mongodbFind({ request , connection }) {
31
32
  await client.close();
32
33
  return serialize(res);
33
34
  }
34
- export default mongodbFind;
35
+ MongodbFind.schema = schema;
36
+ MongodbFind.meta = {
37
+ checkRead: true,
38
+ checkWrite: false
39
+ };
40
+ export default MongodbFind;
@@ -0,0 +1,42 @@
1
+ /*
2
+ Copyright 2020-2021 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Lowdefy Request Schema - MongoDBFind',
18
+ type: 'object',
19
+ required: [
20
+ 'query'
21
+ ],
22
+ properties: {
23
+ query: {
24
+ type: 'object',
25
+ description: 'A MongoDB query object',
26
+ errorMessage: {
27
+ type: 'MongoDBFind request property "query" should be an object.'
28
+ }
29
+ },
30
+ options: {
31
+ type: 'object',
32
+ description: 'Optional settings.',
33
+ errorMessage: {
34
+ type: 'MongoDBFind request property "options" should be an object.'
35
+ }
36
+ }
37
+ },
38
+ errorMessage: {
39
+ type: 'MongoDBFind request properties should be an object.',
40
+ required: 'MongoDBFind request should have required property "query".'
41
+ }
42
+ };
@@ -14,7 +14,8 @@
14
14
  limitations under the License.
15
15
  */ import getCollection from '../getCollection.js';
16
16
  import { serialize, deserialize } from '../serialize.js';
17
- async function mongodbFindOne({ request , connection }) {
17
+ import schema from './schema.js';
18
+ async function MongodbFindOne({ request , connection }) {
18
19
  const deserializedRequest = deserialize(request);
19
20
  const { query , options } = deserializedRequest;
20
21
  const { collection , client } = await getCollection({
@@ -30,4 +31,9 @@ async function mongodbFindOne({ request , connection }) {
30
31
  await client.close();
31
32
  return serialize(res);
32
33
  }
33
- export default mongodbFindOne;
34
+ MongodbFindOne.schema = schema;
35
+ MongodbFindOne.meta = {
36
+ checkRead: true,
37
+ checkWrite: false
38
+ };
39
+ export default MongodbFindOne;
@@ -0,0 +1,42 @@
1
+ /*
2
+ Copyright 2020-2021 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Lowdefy Request Schema - MongoDBFindOne',
18
+ type: 'object',
19
+ required: [
20
+ 'query'
21
+ ],
22
+ properties: {
23
+ query: {
24
+ type: 'object',
25
+ description: 'A MongoDB query object',
26
+ errorMessage: {
27
+ type: 'MongoDBFindOne request property "query" should be an object.'
28
+ }
29
+ },
30
+ options: {
31
+ type: 'object',
32
+ description: 'Optional settings.',
33
+ errorMessage: {
34
+ type: 'MongoDBFindOne request property "options" should be an object.'
35
+ }
36
+ }
37
+ },
38
+ errorMessage: {
39
+ type: 'MongoDBFindOne request properties should be an object.',
40
+ required: 'MongoDBFindOne request should have required property "query".'
41
+ }
42
+ };
@@ -14,7 +14,8 @@
14
14
  limitations under the License.
15
15
  */ import getCollection from '../getCollection.js';
16
16
  import { serialize, deserialize } from '../serialize.js';
17
- async function mongodbInsertMany({ request , connection }) {
17
+ import schema from './schema.js';
18
+ async function MongodbInsertMany({ request , connection }) {
18
19
  const deserializedRequest = deserialize(request);
19
20
  const { docs , options } = deserializedRequest;
20
21
  const { collection , client } = await getCollection({
@@ -28,10 +29,15 @@ async function mongodbInsertMany({ request , connection }) {
28
29
  throw error;
29
30
  }
30
31
  await client.close();
31
- const { insertedCount , ops } = serialize(res);
32
+ const { acknowledged , insertedCount } = serialize(res);
32
33
  return {
33
- insertedCount,
34
- ops
34
+ acknowledged,
35
+ insertedCount
35
36
  };
36
37
  }
37
- export default mongodbInsertMany;
38
+ MongodbInsertMany.schema = schema;
39
+ MongodbInsertMany.meta = {
40
+ checkRead: false,
41
+ checkWrite: true
42
+ };
43
+ export default MongodbInsertMany;
@@ -0,0 +1,48 @@
1
+ /*
2
+ Copyright 2020-2021 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Lowdefy Request Schema - MongoDBInsertMany',
18
+ type: 'object',
19
+ required: [
20
+ 'docs'
21
+ ],
22
+ properties: {
23
+ docs: {
24
+ type: 'array',
25
+ description: 'The array of documents to be inserted.',
26
+ errorMessage: {
27
+ type: 'MongoDBInsertMany request property "docs" should be an array.'
28
+ },
29
+ items: {
30
+ type: 'object',
31
+ errorMessage: {
32
+ type: 'MongoDBInsertMany request property "docs" should be an array of documents to insert.'
33
+ }
34
+ }
35
+ },
36
+ options: {
37
+ type: 'object',
38
+ description: 'Optional settings.',
39
+ errorMessage: {
40
+ type: 'MongoDBInsertMany request property "options" should be an object.'
41
+ }
42
+ }
43
+ },
44
+ errorMessage: {
45
+ type: 'MongoDBInsertMany request properties should be an object.',
46
+ required: 'MongoDBInsertMany request should have required property "docs".'
47
+ }
48
+ };
@@ -14,7 +14,8 @@
14
14
  limitations under the License.
15
15
  */ import getCollection from '../getCollection.js';
16
16
  import { serialize, deserialize } from '../serialize.js';
17
- async function mongodbInsertOne({ request , connection }) {
17
+ import schema from './schema.js';
18
+ async function MongodbInsertOne({ request , connection }) {
18
19
  const deserializedRequest = deserialize(request);
19
20
  const { doc , options } = deserializedRequest;
20
21
  const { collection , client } = await getCollection({
@@ -28,11 +29,15 @@ async function mongodbInsertOne({ request , connection }) {
28
29
  throw error;
29
30
  }
30
31
  await client.close();
31
- const { insertedCount , insertedId , ops } = serialize(res);
32
+ const { acknowledged , insertedId } = serialize(res);
32
33
  return {
33
- insertedCount,
34
- insertedId,
35
- ops
34
+ acknowledged,
35
+ insertedId
36
36
  };
37
37
  }
38
- export default mongodbInsertOne;
38
+ MongodbInsertOne.schema = schema;
39
+ MongodbInsertOne.meta = {
40
+ checkRead: false,
41
+ checkWrite: true
42
+ };
43
+ export default MongodbInsertOne;
@@ -0,0 +1,42 @@
1
+ /*
2
+ Copyright 2020-2021 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Lowdefy Request Schema - MongoDBInsertOne',
18
+ type: 'object',
19
+ required: [
20
+ 'doc'
21
+ ],
22
+ properties: {
23
+ doc: {
24
+ type: 'object',
25
+ description: 'The document to be inserted.',
26
+ errorMessage: {
27
+ type: 'MongoDBInsertOne request property "doc" should be an object.'
28
+ }
29
+ },
30
+ options: {
31
+ type: 'object',
32
+ description: 'Optional settings.',
33
+ errorMessage: {
34
+ type: 'MongoDBInsertOne request property "options" should be an object.'
35
+ }
36
+ }
37
+ },
38
+ errorMessage: {
39
+ type: 'MongoDBInsertOne request properties should be an object.',
40
+ required: 'MongoDBInsertOne request should have required property "doc".'
41
+ }
42
+ };
@@ -14,7 +14,8 @@
14
14
  limitations under the License.
15
15
  */ import getCollection from '../getCollection.js';
16
16
  import { serialize, deserialize } from '../serialize.js';
17
- async function mongodbUpdateMany({ request , connection }) {
17
+ import schema from './schema.js';
18
+ async function MongodbUpdateMany({ request , connection }) {
18
19
  const deserializedRequest = deserialize(request);
19
20
  const { filter , update , options } = deserializedRequest;
20
21
  const { collection , client } = await getCollection({
@@ -36,4 +37,9 @@ async function mongodbUpdateMany({ request , connection }) {
36
37
  matchedCount
37
38
  };
38
39
  }
39
- export default mongodbUpdateMany;
40
+ MongodbUpdateMany.schema = schema;
41
+ MongodbUpdateMany.meta = {
42
+ checkRead: false,
43
+ checkWrite: true
44
+ };
45
+ export default MongodbUpdateMany;
@@ -0,0 +1,56 @@
1
+ /*
2
+ Copyright 2020-2021 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Lowdefy Request Schema - MongoDBUpdateMany',
18
+ type: 'object',
19
+ required: [
20
+ 'filter',
21
+ 'update'
22
+ ],
23
+ properties: {
24
+ filter: {
25
+ type: 'object',
26
+ description: 'The filter used to select the documents to update.',
27
+ errorMessage: {
28
+ type: 'MongoDBUpdateMany request property "filter" should be an object.'
29
+ }
30
+ },
31
+ update: {
32
+ type: [
33
+ 'object',
34
+ 'array'
35
+ ],
36
+ description: 'The update operations to be applied to the documents.',
37
+ errorMessage: {
38
+ type: 'MongoDBUpdateMany request property "update" should be an object.'
39
+ }
40
+ },
41
+ options: {
42
+ type: 'object',
43
+ description: 'Optional settings.',
44
+ errorMessage: {
45
+ type: 'MongoDBUpdateMany request property "options" should be an object.'
46
+ }
47
+ }
48
+ },
49
+ errorMessage: {
50
+ type: 'MongoDBUpdateMany request properties should be an object.',
51
+ required: {
52
+ filter: 'MongoDBUpdateMany request should have required property "filter".',
53
+ update: 'MongoDBUpdateMany request should have required property "update".'
54
+ }
55
+ }
56
+ };
@@ -14,7 +14,8 @@
14
14
  limitations under the License.
15
15
  */ import getCollection from '../getCollection.js';
16
16
  import { serialize, deserialize } from '../serialize.js';
17
- async function mongodbUpdateOne({ request , connection }) {
17
+ import schema from './schema.js';
18
+ async function MongodbUpdateOne({ request , connection }) {
18
19
  const deserializedRequest = deserialize(request);
19
20
  const { filter , update , options } = deserializedRequest;
20
21
  const { collection , client } = await getCollection({
@@ -36,4 +37,9 @@ async function mongodbUpdateOne({ request , connection }) {
36
37
  matchedCount
37
38
  };
38
39
  }
39
- export default mongodbUpdateOne;
40
+ MongodbUpdateOne.schema = schema;
41
+ MongodbUpdateOne.meta = {
42
+ checkRead: false,
43
+ checkWrite: true
44
+ };
45
+ export default MongodbUpdateOne;
@@ -0,0 +1,56 @@
1
+ /*
2
+ Copyright 2020-2021 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Lowdefy Request Schema - MongoDBUpdateOne',
18
+ type: 'object',
19
+ required: [
20
+ 'filter',
21
+ 'update'
22
+ ],
23
+ properties: {
24
+ filter: {
25
+ type: 'object',
26
+ description: 'The filter used to select the document to update.',
27
+ errorMessage: {
28
+ type: 'MongoDBUpdateOne request property "filter" should be an object.'
29
+ }
30
+ },
31
+ update: {
32
+ type: [
33
+ 'object',
34
+ 'array'
35
+ ],
36
+ description: 'The update operations to be applied to the document.',
37
+ errorMessage: {
38
+ type: 'MongoDBUpdateOne request property "update" should be an object.'
39
+ }
40
+ },
41
+ options: {
42
+ type: 'object',
43
+ description: 'Optional settings.',
44
+ errorMessage: {
45
+ type: 'MongoDBUpdateOne request property "options" should be an object.'
46
+ }
47
+ }
48
+ },
49
+ errorMessage: {
50
+ type: 'MongoDBUpdateOne request properties should be an object.',
51
+ required: {
52
+ filter: 'MongoDBUpdateOne request should have required property "filter".',
53
+ update: 'MongoDBUpdateOne request should have required property "update".'
54
+ }
55
+ }
56
+ };