Skip to content

Commit

Permalink
fix: get operation when skipIdTransformations is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
playerx committed May 19, 2019
1 parent 1967e2f commit d1e65f8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/operations/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ export default function getFn<TDocument extends DocumentBase>(
) {
return async function get(id: ID): Promise<TDocument | null> {

let _id: ObjectId | undefined = new ObjectId(id)
let _id: ObjectId | undefined
let idParam: string | undefined

if (repositoryOptions && repositoryOptions.skipIdTransformations) {
_id = undefined
idParam = id
}
else {
_id = new ObjectId(id)
}

const doc = await db.collection(collectionName).findOne<TDocument>({
_id,
Expand Down

0 comments on commit d1e65f8

Please sign in to comment.