Merge pull request #2823 from Budibase/fix/mongodb-2696
Fix for #2696 - adding awaits to mongodb connector
This commit is contained in:
commit
c9059f1d5e
|
@ -85,10 +85,10 @@ module MongoDBModule {
|
||||||
// which method we want to call on the collection
|
// which method we want to call on the collection
|
||||||
switch (query.extra.actionTypes) {
|
switch (query.extra.actionTypes) {
|
||||||
case "insertOne": {
|
case "insertOne": {
|
||||||
return collection.insertOne(query.json)
|
return await collection.insertOne(query.json)
|
||||||
}
|
}
|
||||||
case "insertMany": {
|
case "insertMany": {
|
||||||
return collection.insertOne(query.json).toArray()
|
return await collection.insertOne(query.json).toArray()
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
@ -112,19 +112,19 @@ module MongoDBModule {
|
||||||
|
|
||||||
switch (query.extra.actionTypes) {
|
switch (query.extra.actionTypes) {
|
||||||
case "find": {
|
case "find": {
|
||||||
return collection.find(query.json).toArray()
|
return await collection.find(query.json).toArray()
|
||||||
}
|
}
|
||||||
case "findOne": {
|
case "findOne": {
|
||||||
return collection.findOne(query.json)
|
return await collection.findOne(query.json)
|
||||||
}
|
}
|
||||||
case "findOneAndUpdate": {
|
case "findOneAndUpdate": {
|
||||||
return collection.findOneAndUpdate(query.json)
|
return await collection.findOneAndUpdate(query.json)
|
||||||
}
|
}
|
||||||
case "count": {
|
case "count": {
|
||||||
return collection.countDocuments(query.json)
|
return await collection.countDocuments(query.json)
|
||||||
}
|
}
|
||||||
case "distinct": {
|
case "distinct": {
|
||||||
return collection.distinct(query.json)
|
return await collection.distinct(query.json)
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
@ -148,10 +148,10 @@ module MongoDBModule {
|
||||||
|
|
||||||
switch (query.extra.actionTypes) {
|
switch (query.extra.actionTypes) {
|
||||||
case "updateOne": {
|
case "updateOne": {
|
||||||
return collection.updateOne(query.json)
|
return await collection.updateOne(query.json)
|
||||||
}
|
}
|
||||||
case "updateMany": {
|
case "updateMany": {
|
||||||
return collection.updateMany(query.json).toArray()
|
return await collection.updateMany(query.json).toArray()
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
@ -175,10 +175,10 @@ module MongoDBModule {
|
||||||
|
|
||||||
switch (query.extra.actionTypes) {
|
switch (query.extra.actionTypes) {
|
||||||
case "deleteOne": {
|
case "deleteOne": {
|
||||||
return collection.deleteOne(query.json)
|
return await collection.deleteOne(query.json)
|
||||||
}
|
}
|
||||||
case "deleteMany": {
|
case "deleteMany": {
|
||||||
return collection.deleteMany(query.json).toArray()
|
return await collection.deleteMany(query.json).toArray()
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|
Loading…
Reference in New Issue