Skip to content

Commit

Permalink
Add converter to objectid
Browse files Browse the repository at this point in the history
  • Loading branch information
SirAnthony committed May 8, 2020
1 parent 62d0839 commit bf3ec81
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/app/services/mongo-db.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ export class HttpUrlEncodingCodec implements HttpParameterCodec {
decodeValue(v: string) { return decodeURIComponent(v); }
}

export function toObjectId(obj) {
if (!obj || obj.$type !== 'ObjectId') {
return obj; }
return `ObjectId('${obj.$value}')`;
}

@Injectable()
export class MongoDbService {
private apiBaseUrl = 'api';
Expand Down

0 comments on commit bf3ec81

Please sign in to comment.