Working with ObjectId - Angular2


#1

I’m using mongo style object id generation but find them a bit annoying for converting to and from strings…
I need the ids in my routerLinks so I need to convert them to strings - {{myId.str}} doesn’t seem to work but I got it working with {{myId + ‘’}}
I now need to convert the string back to an ObjectId in my service to get a document by its ID and I can’t seem to get it to work.

I’ve tried:
ObjectId(myId)
new ObjectId(myId)

But ObjectId isn’t recognised. I think I also tried Mongo.ObjectId(myId) but that didn’t work either

What’s the best approach for this?