blackhole.db 1.1.0 → 1.1.1

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/index.js +6 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -179,18 +179,18 @@ class Model {
179
179
 
180
180
  // Update
181
181
  async updateOne(f, u) {
182
- const d = await this.findOne(f);
182
+ const d = await this.findOne(f).exec();
183
183
  if (!d) return { matchedCount: 0 };
184
184
  Object.assign(d, u); await d.save();
185
185
  return { matchedCount: 1 };
186
186
  }
187
187
  async updateMany(f, u) {
188
- const ds = await this.find(f);
188
+ const ds = await this.find(f).exec();
189
189
  for (let d of ds) { Object.assign(d, u); await d.save(); }
190
190
  return { matchedCount: ds.length };
191
191
  }
192
192
  async findOneAndUpdate(f, u, opts = {}) {
193
- const d = await this.findOne(f);
193
+ const d = await this.findOne(f).exec();
194
194
  if (!d) return opts.upsert ? this.create({ ...f, ...u }) : null;
195
195
  Object.assign(d, u); return d.save();
196
196
  }
@@ -198,17 +198,17 @@ class Model {
198
198
 
199
199
  // Delete
200
200
  async deleteOne(f) {
201
- const d = await this.findOne(f);
201
+ const d = await this.findOne(f).exec();
202
202
  if (!d) return { deletedCount: 0 };
203
203
  await d.deleteOne(); return { deletedCount: 1 };
204
204
  }
205
205
  async deleteMany(f) {
206
- const ds = await this.find(f);
206
+ const ds = await this.find(f).exec();
207
207
  for (let d of ds) await d.deleteOne();
208
208
  return { deletedCount: ds.length };
209
209
  }
210
210
  async findOneAndDelete(f) {
211
- const d = await this.findOne(f);
211
+ const d = await this.findOne(f).exec();
212
212
  if (d) await d.deleteOne(); return d;
213
213
  }
214
214
  findByIdAndDelete(id) { return this.findOneAndDelete({ _id: id }); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blackhole.db",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "uuid": "^9.0.1"