@lowdefy/connection-mongodb 4.0.0-alpha.6 → 4.0.0-alpha.9
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.
- package/dist/connections/MongoDBCollection/MongoDBAggregation/MongoDBAggregation.js +9 -3
- package/dist/connections/MongoDBCollection/MongoDBAggregation/schema.js +42 -0
- package/dist/connections/MongoDBCollection/MongoDBCollection.js +3 -4
- package/dist/connections/MongoDBCollection/MongoDBDeleteMany/MongoDBDeleteMany.js +11 -4
- package/dist/connections/MongoDBCollection/MongoDBDeleteMany/schema.js +42 -0
- package/dist/connections/MongoDBCollection/MongoDBDeleteOne/MongoDBDeleteOne.js +11 -4
- package/dist/connections/MongoDBCollection/MongoDBDeleteOne/schema.js +42 -0
- package/dist/connections/MongoDBCollection/MongoDBFind/MongoDBFind.js +9 -3
- package/dist/connections/MongoDBCollection/MongoDBFind/schema.js +42 -0
- package/dist/connections/MongoDBCollection/MongoDBFindOne/MongoDBFindOne.js +9 -3
- package/dist/connections/MongoDBCollection/MongoDBFindOne/schema.js +42 -0
- package/dist/connections/MongoDBCollection/MongoDBInsertMany/MongoDBInsertMany.js +12 -6
- package/dist/connections/MongoDBCollection/MongoDBInsertMany/schema.js +48 -0
- package/dist/connections/MongoDBCollection/MongoDBInsertOne/MongoDBInsertOne.js +12 -7
- package/dist/connections/MongoDBCollection/MongoDBInsertOne/schema.js +42 -0
- package/dist/connections/MongoDBCollection/MongoDBUpdateMany/MongoDBUpdateMany.js +9 -3
- package/dist/connections/MongoDBCollection/MongoDBUpdateMany/schema.js +56 -0
- package/dist/connections/MongoDBCollection/MongoDBUpdateOne/MongoDBUpdateOne.js +9 -3
- package/dist/connections/MongoDBCollection/MongoDBUpdateOne/schema.js +56 -0
- package/dist/connections/MongoDBCollection/getCollection.js +1 -1
- package/dist/connections/MongoDBCollection/schema.js +69 -0
- package/dist/connections/MongoDBCollection/serialize.js +5 -5
- package/dist/{connections/MongoDBCollection/MongoDBFind/index.js → connections.js} +2 -11
- package/dist/{connections/MongoDBCollection/MongoDBFindOne/index.js → types.js} +7 -11
- package/package.json +12 -11
- package/dist/connections/MongoDBCollection/MongoDBAggregation/MongoDBAggregationSchema.json +0 -26
- package/dist/connections/MongoDBCollection/MongoDBAggregation/index.js +0 -24
- package/dist/connections/MongoDBCollection/MongoDBCollectionSchema.json +0 -52
- package/dist/connections/MongoDBCollection/MongoDBDeleteMany/MongoDBDeleteManySchema.json +0 -26
- package/dist/connections/MongoDBCollection/MongoDBDeleteMany/index.js +0 -24
- package/dist/connections/MongoDBCollection/MongoDBDeleteOne/MongoDBDeleteOneSchema.json +0 -26
- package/dist/connections/MongoDBCollection/MongoDBDeleteOne/index.js +0 -24
- package/dist/connections/MongoDBCollection/MongoDBFind/MongoDBFindSchema.json +0 -26
- package/dist/connections/MongoDBCollection/MongoDBFindOne/MongoDBFindOneSchema.json +0 -26
- package/dist/connections/MongoDBCollection/MongoDBInsertMany/MongoDBInsertManySchema.json +0 -32
- package/dist/connections/MongoDBCollection/MongoDBInsertMany/index.js +0 -24
- package/dist/connections/MongoDBCollection/MongoDBInsertOne/MongoDBInsertOneSchema.json +0 -26
- package/dist/connections/MongoDBCollection/MongoDBInsertOne/index.js +0 -24
- package/dist/connections/MongoDBCollection/MongoDBUpdateMany/MongoDBUpdateManySchema.json +0 -36
- package/dist/connections/MongoDBCollection/MongoDBUpdateMany/index.js +0 -24
- package/dist/connections/MongoDBCollection/MongoDBUpdateOne/MongoDBUpdateOneSchema.json +0 -36
- package/dist/connections/MongoDBCollection/MongoDBUpdateOne/index.js +0 -24
- package/dist/index.js +0 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
|
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
|
-
|
|
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-2022 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
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
-
|
|
26
|
-
schema: 'connections/MongoDBCollection/MongoDBCollectionSchema.json'
|
|
27
|
-
},
|
|
26
|
+
schema,
|
|
28
27
|
requests: {
|
|
29
28
|
MongoDBAggregation,
|
|
30
29
|
MongoDBDeleteMany,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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-2022 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
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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-2022 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
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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-2022 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
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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-2022 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
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
-
|
|
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 {
|
|
32
|
+
const { acknowledged , insertedCount } = serialize(res);
|
|
32
33
|
return {
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
acknowledged,
|
|
35
|
+
insertedCount
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
|
-
|
|
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-2022 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
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
-
|
|
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 {
|
|
32
|
+
const { acknowledged , insertedId } = serialize(res);
|
|
32
33
|
return {
|
|
33
|
-
|
|
34
|
-
insertedId
|
|
35
|
-
ops
|
|
34
|
+
acknowledged,
|
|
35
|
+
insertedId
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
|
|
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-2022 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
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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-2022 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
|
+
};
|