(
collection: Collection,
document: Document,
options: { forceServerObjectId?: boolean }
)
| 1300 | } |
| 1301 | |
| 1302 | export function maybeAddIdToDocuments( |
| 1303 | collection: Collection, |
| 1304 | document: Document, |
| 1305 | options: { forceServerObjectId?: boolean } |
| 1306 | ): Document { |
| 1307 | const forceServerObjectId = |
| 1308 | options.forceServerObjectId ?? collection.db.options?.forceServerObjectId ?? false; |
| 1309 | |
| 1310 | // no need to modify the docs if server sets the ObjectId |
| 1311 | if (forceServerObjectId) { |
| 1312 | return document; |
| 1313 | } |
| 1314 | |
| 1315 | if (document._id == null) { |
| 1316 | document._id = collection.s.pkFactory.createPk(); |
| 1317 | } |
| 1318 | |
| 1319 | return document; |
| 1320 | } |
| 1321 | |
| 1322 | export async function fileIsAccessible(fileName: string, mode?: number) { |
| 1323 | try { |
no test coverage detected