@pi-r/atlas 0.2.2 → 0.2.3

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 (2) hide show
  1. package/client/index.js +11 -4
  2. package/package.json +3 -3
package/client/index.js CHANGED
@@ -133,11 +133,14 @@ async function executeBatchQuery(credential, batch, sessionKey) {
133
133
  }
134
134
  if ((0, types_1.isArray)(update)) {
135
135
  const insertOptions = item.execute?.insert;
136
- if (insertOptions) {
137
- await collection.insertMany(update, coercing ? (0, types_1.coerceObject)(insertOptions) : insertOptions);
136
+ if (insertOptions && coercing) {
137
+ (0, types_1.coerceObject)(insertOptions);
138
+ }
139
+ if (update.length === 1) {
140
+ await collection.insertOne(update[0], insertOptions);
138
141
  }
139
142
  else {
140
- await collection.insertMany(update);
143
+ await collection.insertMany(update, insertOptions);
141
144
  }
142
145
  update = undefined;
143
146
  }
@@ -150,7 +153,11 @@ async function executeBatchQuery(credential, batch, sessionKey) {
150
153
  }
151
154
  else {
152
155
  if (update) {
153
- await collection.updateMany(filter, update);
156
+ const updateOptions = item.execute?.update;
157
+ if (updateOptions && coercing) {
158
+ (0, types_1.coerceObject)(updateOptions);
159
+ }
160
+ await collection.updateMany(filter, update, updateOptions);
154
161
  }
155
162
  const items = collection.find(filter, command);
156
163
  if (sort) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/atlas",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "MongoDB Atlas cloud functions for E-mc.",
5
5
  "main": "client/index.js",
6
6
  "publishConfig": {
@@ -24,7 +24,7 @@
24
24
  "@e-mc/db": "^0.5.3",
25
25
  "@e-mc/module": "^0.5.3",
26
26
  "@e-mc/types": "^0.5.3",
27
- "@pi-r/mongodb": "^0.2.2",
28
- "mongodb": "^5.5.0"
27
+ "@pi-r/mongodb": "^0.2.3",
28
+ "mongodb": "^5.7.0"
29
29
  }
30
30
  }