@better-auth/mongo-adapter 1.6.10 → 1.6.11

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/dist/index.mjs +14 -1
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -404,6 +404,16 @@ const mongodbAdapter = (db, config) => {
404
404
  model
405
405
  });
406
406
  return (await db.collection(model).deleteMany(clause, { session })).deletedCount;
407
+ },
408
+ async consumeOne({ model, where }) {
409
+ const clause = convertWhereClause({
410
+ where,
411
+ model
412
+ });
413
+ return (await db.collection(model).findOneAndDelete(clause, {
414
+ session,
415
+ includeResultMetadata: true
416
+ }))?.value ?? null;
407
417
  }
408
418
  };
409
419
  };
@@ -425,7 +435,10 @@ const mongodbAdapter = (db, config) => {
425
435
  try {
426
436
  session.startTransaction();
427
437
  const result = await cb(createAdapterFactory({
428
- config: adapterOptions.config,
438
+ config: {
439
+ ...adapterOptions.config,
440
+ transaction: false
441
+ },
429
442
  adapter: createCustomAdapter(db, session)
430
443
  })(lazyOptions));
431
444
  await session.commitTransaction();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/mongo-adapter",
3
- "version": "1.6.10",
3
+ "version": "1.6.11",
4
4
  "description": "Mongo adapter for Better Auth",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "peerDependencies": {
38
38
  "@better-auth/utils": "0.4.0",
39
39
  "mongodb": "^6.0.0 || ^7.0.0",
40
- "@better-auth/core": "^1.6.10"
40
+ "@better-auth/core": "^1.6.11"
41
41
  },
42
42
  "peerDependenciesMeta": {
43
43
  "mongodb": {
@@ -49,7 +49,7 @@
49
49
  "mongodb": "^7.1.0",
50
50
  "tsdown": "0.21.1",
51
51
  "typescript": "^5.9.3",
52
- "@better-auth/core": "1.6.10"
52
+ "@better-auth/core": "1.6.11"
53
53
  },
54
54
  "scripts": {
55
55
  "build": "tsdown",