Thursday, 13 April 2017

convert mongodb _id to string node js

I want to convert mongodb id to string.

     var cursor = db.collection('student-data').findOne({'username':SSN.username}, {'_id':1},function(error, result){

I used this and now I get

{ _id: 58d06a02e2a8c828806e5478 }

which is good but how to get only that number?

58d06a02e2a8c828806e5478



via pim88

No comments:

Post a Comment