@payloadcms/db-mongodb 4.0.0-canary.16 → 4.0.0-canary.17

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.
@@ -1 +1 @@
1
- {"version":3,"file":"updateJobs.d.ts","sourceRoot":"","sources":["../src/updateJobs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAO,UAAU,EAAS,MAAM,SAAS,CAAA;AAWrD,eAAO,MAAM,UAAU,EAAE,UAiIxB,CAAA"}
1
+ {"version":3,"file":"updateJobs.d.ts","sourceRoot":"","sources":["../src/updateJobs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAO,UAAU,EAAS,MAAM,SAAS,CAAA;AAWrD,eAAO,MAAM,UAAU,EAAE,UAiLxB,CAAA"}
@@ -24,7 +24,7 @@ export const updateJobs = async function updateMany({ id, data, limit, req, retu
24
24
  sort: sortArg || collectionConfig.defaultSort,
25
25
  timestamps: true
26
26
  });
27
- let query = await buildQuery({
27
+ const query = await buildQuery({
28
28
  adapter: this,
29
29
  collectionSlug: collectionConfig.slug,
30
30
  fields: collectionConfig.flattenedFields,
@@ -90,25 +90,82 @@ export const updateJobs = async function updateMany({ id, data, limit, req, retu
90
90
  doc
91
91
  ] : [];
92
92
  }
93
- } else {
94
- if (typeof limit === 'number' && limit > 0) {
95
- const documentsToUpdate = await Model.find(query, {}, {
96
- ...findOptions,
97
- limit,
98
- projection: {
99
- _id: 1
93
+ } else if (limit === 1) {
94
+ /**
95
+ * Select, update, and return one job atomically in a single database call.
96
+ * We can only do this with limit === 1, which can be expressed as findOne.
97
+ */ const doc = await Model.findOneAndUpdate(query, updateData, {
98
+ ...findOptions,
99
+ projection: returning === false ? {
100
+ _id: 1
101
+ } : undefined,
102
+ sort
103
+ });
104
+ if (returning === false) {
105
+ return null;
106
+ }
107
+ result = doc ? [
108
+ doc
109
+ ] : [];
110
+ } else if (typeof limit === 'number' && limit > 1) {
111
+ const candidates = await Model.find(query, {}, {
112
+ ...findOptions,
113
+ limit,
114
+ projection: {
115
+ _id: 1
116
+ },
117
+ sort
118
+ });
119
+ if (candidates.length === 0) {
120
+ return null;
121
+ }
122
+ const candidateIDs = candidates.map((candidate)=>candidate._id);
123
+ if (typeof data.processingToken === 'string') {
124
+ /**
125
+ * `processingToken` identifies this claim update. `processing: true` cannot, because every
126
+ * worker writes the same value. The token lets us reliably find the jobs this update won.
127
+ */ const claimQuery = {
128
+ $and: [
129
+ query,
130
+ {
131
+ _id: {
132
+ $in: candidateIDs
133
+ }
134
+ }
135
+ ]
136
+ };
137
+ await Model.updateMany(claimQuery, updateData, baseOptions);
138
+ if (returning === false) {
139
+ return null;
140
+ }
141
+ const claimedJobsQuery = {
142
+ _id: {
143
+ $in: candidateIDs
100
144
  },
145
+ processingToken: {
146
+ $eq: data.processingToken
147
+ }
148
+ };
149
+ result = await Model.find(claimedJobsQuery, {}, {
150
+ ...findOptions,
101
151
  sort
102
152
  });
103
- if (documentsToUpdate.length === 0) {
104
- return null;
105
- }
106
- query = {
153
+ } else {
154
+ const limitedUpdateQuery = {
107
155
  _id: {
108
- $in: documentsToUpdate.map((doc)=>doc._id)
156
+ $in: candidateIDs
109
157
  }
110
158
  };
159
+ await Model.updateMany(limitedUpdateQuery, updateData, baseOptions);
160
+ if (returning === false) {
161
+ return null;
162
+ }
163
+ result = await Model.find(limitedUpdateQuery, {}, {
164
+ ...findOptions,
165
+ sort
166
+ });
111
167
  }
168
+ } else {
112
169
  await Model.updateMany(query, updateData, baseOptions);
113
170
  if (returning === false) {
114
171
  return null;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/updateJobs.ts"],"sourcesContent":["import type { QueryOptions, UpdateQuery } from 'mongoose'\nimport type { Job, UpdateJobs, Where } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildSortParam } from './queries/buildSortParam.js'\nimport { getCollection } from './utilities/getEntity.js'\nimport { getSession } from './utilities/getSession.js'\nimport { handleError } from './utilities/handleError.js'\nimport { transform } from './utilities/transform.js'\n\nexport const updateJobs: UpdateJobs = async function updateMany(\n this: MongooseAdapter,\n { id, data, limit, req, returning, sort: sortArg, where: whereArg },\n) {\n if (\n !(data?.log as object[])?.length &&\n !(data.log && typeof data.log === 'object' && '$push' in data.log)\n ) {\n delete data.log\n }\n\n const where = id ? { id: { equals: id } } : (whereArg as Where)\n\n const { collectionConfig, Model } = getCollection({\n adapter: this,\n collectionSlug: 'payload-jobs',\n })\n\n const sort: Record<string, unknown> | undefined = buildSortParam({\n adapter: this,\n config: this.payload.config,\n fields: collectionConfig.flattenedFields,\n sort: sortArg || collectionConfig.defaultSort,\n timestamps: true,\n })\n\n let query = await buildQuery({\n adapter: this,\n collectionSlug: collectionConfig.slug,\n fields: collectionConfig.flattenedFields,\n where,\n })\n\n let updateData: UpdateQuery<any> = data\n\n const $inc: Record<string, number> = {}\n const $push: Record<string, { $each: any[] } | any> = {}\n const $addToSet: Record<string, { $each: any[] } | any> = {}\n const $pull: Record<string, { $in: any[] } | any> = {}\n\n transform({\n $addToSet,\n $inc,\n $pull,\n $push,\n adapter: this,\n data,\n fields: collectionConfig.fields,\n operation: 'write',\n })\n\n const updateOps: UpdateQuery<any> = {}\n\n if (Object.keys($inc).length) {\n updateOps.$inc = $inc\n }\n if (Object.keys($push).length) {\n updateOps.$push = $push\n }\n if (Object.keys($addToSet).length) {\n updateOps.$addToSet = $addToSet\n }\n if (Object.keys($pull).length) {\n updateOps.$pull = $pull\n }\n if (Object.keys(updateOps).length) {\n updateOps.$set = updateData\n updateData = updateOps\n }\n\n const baseOptions = {\n session: await getSession(this, req),\n // Timestamps are manually added by the write transform\n timestamps: false,\n } satisfies QueryOptions\n\n const findOptions: QueryOptions = {\n ...baseOptions,\n lean: true,\n new: true,\n }\n\n let result: Job[] = []\n\n try {\n if (id) {\n if (returning === false) {\n await Model.updateOne(query, updateData, baseOptions)\n transform({ adapter: this, data, fields: collectionConfig.fields, operation: 'read' })\n\n return null\n } else {\n const doc = await Model.findOneAndUpdate(query, updateData, findOptions)\n result = doc ? [doc] : []\n }\n } else {\n if (typeof limit === 'number' && limit > 0) {\n const documentsToUpdate = await Model.find(\n query,\n {},\n { ...findOptions, limit, projection: { _id: 1 }, sort },\n )\n if (documentsToUpdate.length === 0) {\n return null\n }\n\n query = { _id: { $in: documentsToUpdate.map((doc) => doc._id) } }\n }\n\n await Model.updateMany(query, updateData, baseOptions)\n\n if (returning === false) {\n return null\n }\n\n result = await Model.find(query, {}, { ...findOptions, sort })\n }\n } catch (error) {\n handleError({ collection: collectionConfig.slug, error, req })\n }\n\n transform({\n adapter: this,\n data: result,\n fields: collectionConfig.fields,\n operation: 'read',\n })\n\n return result\n}\n"],"names":["buildQuery","buildSortParam","getCollection","getSession","handleError","transform","updateJobs","updateMany","id","data","limit","req","returning","sort","sortArg","where","whereArg","log","length","equals","collectionConfig","Model","adapter","collectionSlug","config","payload","fields","flattenedFields","defaultSort","timestamps","query","slug","updateData","$inc","$push","$addToSet","$pull","operation","updateOps","Object","keys","$set","baseOptions","session","findOptions","lean","new","result","updateOne","doc","findOneAndUpdate","documentsToUpdate","find","projection","_id","$in","map","error","collection"],"mappings":"AAKA,SAASA,UAAU,QAAQ,0BAAyB;AACpD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,aAAa,QAAQ,2BAA0B;AACxD,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,WAAW,QAAQ,6BAA4B;AACxD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,aAAyB,eAAeC,WAEnD,EAAEC,EAAE,EAAEC,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAEC,SAAS,EAAEC,MAAMC,OAAO,EAAEC,OAAOC,QAAQ,EAAE;IAEnE,IACE,CAAEP,MAAMQ,KAAkBC,UAC1B,CAAET,CAAAA,KAAKQ,GAAG,IAAI,OAAOR,KAAKQ,GAAG,KAAK,YAAY,WAAWR,KAAKQ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AiBW,IAAI;YAAE0B;YAAO9C;QAAI;IAC9D;IAEAN,UAAU;QACRiB,SAAS,IAAI;QACbb,MAAMsC;QACNrB,QAAQN,iBAAiBM,MAAM;QAC/BW,WAAW;IACb;IAEA,OAAOU;AACT,EAAC"}
1
+ {"version":3,"sources":["../src/updateJobs.ts"],"sourcesContent":["import type { QueryOptions, UpdateQuery } from 'mongoose'\nimport type { Job, UpdateJobs, Where } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildSortParam } from './queries/buildSortParam.js'\nimport { getCollection } from './utilities/getEntity.js'\nimport { getSession } from './utilities/getSession.js'\nimport { handleError } from './utilities/handleError.js'\nimport { transform } from './utilities/transform.js'\n\nexport const updateJobs: UpdateJobs = async function updateMany(\n this: MongooseAdapter,\n { id, data, limit, req, returning, sort: sortArg, where: whereArg },\n) {\n if (\n !(data?.log as object[])?.length &&\n !(data.log && typeof data.log === 'object' && '$push' in data.log)\n ) {\n delete data.log\n }\n\n const where = id ? { id: { equals: id } } : (whereArg as Where)\n\n const { collectionConfig, Model } = getCollection({\n adapter: this,\n collectionSlug: 'payload-jobs',\n })\n\n const sort: Record<string, unknown> | undefined = buildSortParam({\n adapter: this,\n config: this.payload.config,\n fields: collectionConfig.flattenedFields,\n sort: sortArg || collectionConfig.defaultSort,\n timestamps: true,\n })\n\n const query = await buildQuery({\n adapter: this,\n collectionSlug: collectionConfig.slug,\n fields: collectionConfig.flattenedFields,\n where,\n })\n\n let updateData: UpdateQuery<any> = data\n\n const $inc: Record<string, number> = {}\n const $push: Record<string, { $each: any[] } | any> = {}\n const $addToSet: Record<string, { $each: any[] } | any> = {}\n const $pull: Record<string, { $in: any[] } | any> = {}\n\n transform({\n $addToSet,\n $inc,\n $pull,\n $push,\n adapter: this,\n data,\n fields: collectionConfig.fields,\n operation: 'write',\n })\n\n const updateOps: UpdateQuery<any> = {}\n\n if (Object.keys($inc).length) {\n updateOps.$inc = $inc\n }\n if (Object.keys($push).length) {\n updateOps.$push = $push\n }\n if (Object.keys($addToSet).length) {\n updateOps.$addToSet = $addToSet\n }\n if (Object.keys($pull).length) {\n updateOps.$pull = $pull\n }\n if (Object.keys(updateOps).length) {\n updateOps.$set = updateData\n updateData = updateOps\n }\n\n const baseOptions = {\n session: await getSession(this, req),\n // Timestamps are manually added by the write transform\n timestamps: false,\n } satisfies QueryOptions\n\n const findOptions: QueryOptions = {\n ...baseOptions,\n lean: true,\n new: true,\n }\n\n let result: Job[] = []\n\n try {\n if (id) {\n if (returning === false) {\n await Model.updateOne(query, updateData, baseOptions)\n transform({ adapter: this, data, fields: collectionConfig.fields, operation: 'read' })\n\n return null\n } else {\n const doc = await Model.findOneAndUpdate(query, updateData, findOptions)\n result = doc ? [doc] : []\n }\n } else if (limit === 1) {\n /**\n * Select, update, and return one job atomically in a single database call.\n * We can only do this with limit === 1, which can be expressed as findOne.\n */\n const doc = await Model.findOneAndUpdate(query, updateData, {\n ...findOptions,\n projection: returning === false ? { _id: 1 } : undefined,\n sort,\n })\n\n if (returning === false) {\n return null\n }\n\n result = doc ? [doc] : []\n } else if (typeof limit === 'number' && limit > 1) {\n const candidates = await Model.find(\n query,\n {},\n { ...findOptions, limit, projection: { _id: 1 }, sort },\n )\n\n if (candidates.length === 0) {\n return null\n }\n\n const candidateIDs = candidates.map((candidate) => candidate._id)\n\n if (typeof data.processingToken === 'string') {\n /**\n * `processingToken` identifies this claim update. `processing: true` cannot, because every\n * worker writes the same value. The token lets us reliably find the jobs this update won.\n */\n const claimQuery = {\n $and: [query, { _id: { $in: candidateIDs } }],\n }\n\n await Model.updateMany(claimQuery, updateData, baseOptions)\n\n if (returning === false) {\n return null\n }\n\n const claimedJobsQuery = {\n _id: { $in: candidateIDs },\n processingToken: { $eq: data.processingToken },\n }\n\n result = await Model.find(claimedJobsQuery, {}, { ...findOptions, sort })\n } else {\n const limitedUpdateQuery = { _id: { $in: candidateIDs } }\n\n await Model.updateMany(limitedUpdateQuery, updateData, baseOptions)\n\n if (returning === false) {\n return null\n }\n\n result = await Model.find(limitedUpdateQuery, {}, { ...findOptions, sort })\n }\n } else {\n await Model.updateMany(query, updateData, baseOptions)\n\n if (returning === false) {\n return null\n }\n\n result = await Model.find(query, {}, { ...findOptions, sort })\n }\n } catch (error) {\n handleError({ collection: collectionConfig.slug, error, req })\n }\n\n transform({\n adapter: this,\n data: result,\n fields: collectionConfig.fields,\n operation: 'read',\n })\n\n return result\n}\n"],"names":["buildQuery","buildSortParam","getCollection","getSession","handleError","transform","updateJobs","updateMany","id","data","limit","req","returning","sort","sortArg","where","whereArg","log","length","equals","collectionConfig","Model","adapter","collectionSlug","config","payload","fields","flattenedFields","defaultSort","timestamps","query","slug","updateData","$inc","$push","$addToSet","$pull","operation","updateOps","Object","keys","$set","baseOptions","session","findOptions","lean","new","result","updateOne","doc","findOneAndUpdate","projection","_id","undefined","candidates","find","candidateIDs","map","candidate","processingToken","claimQuery","$and","$in","claimedJobsQuery","$eq","limitedUpdateQuery","error","collection"],"mappings":"AAKA,SAASA,UAAU,QAAQ,0BAAyB;AACpD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,aAAa,QAAQ,2BAA0B;AACxD,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,WAAW,QAAQ,6BAA4B;AACxD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,aAAyB,eAAeC,WAEnD,EAAEC,EAAE,EAAEC,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAEC,SAAS,EAAEC,MAAMC,OAAO,EAAEC,OAAOC,QAAQ,EAAE;IAEnE,IACE,CAAEP,MAAMQ,KAAkBC,UAC1B,CAAET,CAAAA,KAAKQ,GAAG,IAAI,OAAOR,KAAKQ,GAAG,KAAK,YAAY,WAAWR,KAAKQ,GAAG,AAAD,GAChE;QACA,OAAOR,KAAKQ,GAAG;IACjB;IAEA,MAAMF,QAAQP,KAAK;QAAEA,IAAI;YAAEW,QAAQX;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CAAEU,KAAKN;4BAAa;wBAAE;qBAAE;gBAC/C;gBAEA,MAAMnC,MAAMd,UAAU,CAACqD,YAAY5B,YAAYU;gBAE/C,IAAI9B,cAAc,OAAO;oBACvB,OAAO;gBACT;gBAEA,MAAMmD,mBAAmB;oBACvBX,KAAK;wBAAEU,KAAKN;oBAAa;oBACzBG,iBAAiB;wBAAEK,KAAKvD,KAAKkD,eAAe;oBAAC;gBAC/C;gBAEAZ,SAAS,MAAM1B,MAAMkC,IAAI,CAACQ,kBAAkB,CAAC,GAAG;oBAAE,GAAGnB,WAAW;oBAAE/B;gBAAK;YACzE,OAAO;gBACL,MAAMoD,qBAAqB;oBAAEb,KAAK;wBAAEU,KAAKN;oBAAa;gBAAE;gBAExD,MAAMnC,MAAMd,UAAU,CAAC0D,oBAAoBjC,YAAYU;gBAEvD,IAAI9B,cAAc,OAAO;oBACvB,OAAO;gBACT;gBAEAmC,SAAS,MAAM1B,MAAMkC,IAAI,CAACU,oBAAoB,CAAC,GAAG;oBAAE,GAAGrB,WAAW;oBAAE/B;gBAAK;YAC3E;QACF,OAAO;YACL,MAAMQ,MAAMd,UAAU,CAACuB,OAAOE,YAAYU;YAE1C,IAAI9B,cAAc,OAAO;gBACvB,OAAO;YACT;YAEAmC,SAAS,MAAM1B,MAAMkC,IAAI,CAACzB,OAAO,CAAC,GAAG;gBAAE,GAAGc,WAAW;gBAAE/B;YAAK;QAC9D;IACF,EAAE,OAAOqD,OAAO;QACd9D,YAAY;YAAE+D,YAAY/C,iBAAiBW,IAAI;YAAEmC;YAAOvD;QAAI;IAC9D;IAEAN,UAAU;QACRiB,SAAS,IAAI;QACbb,MAAMsC;QACNrB,QAAQN,iBAAiBM,MAAM;QAC/BW,WAAW;IACb;IAEA,OAAOU;AACT,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/db-mongodb",
3
- "version": "4.0.0-canary.16",
3
+ "version": "4.0.0-canary.17",
4
4
  "description": "The officially supported MongoDB database adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -54,10 +54,10 @@
54
54
  "mongodb": "6.20.0",
55
55
  "mongodb-memory-server": "10.1.4",
56
56
  "@payloadcms/eslint-config": "3.28.0",
57
- "payload": "4.0.0-canary.16"
57
+ "payload": "4.0.0-canary.17"
58
58
  },
59
59
  "peerDependencies": {
60
- "payload": "4.0.0-canary.16"
60
+ "payload": "4.0.0-canary.17"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "pnpm build:types && pnpm build:swc",