node.js - How to get the double quotes arround number typed field from MongoDB aggregation query result? -
scenario: have collection 'people' following documents
{ "_id" : objectid("512bc95fe835e68f199c8686"), "name": "david", "age" : 78 }, { "_id" : objectid("512bc962e835e68f199c8687"), "name" : "dave", "age" : 35 } when query using following code node.js
db.articles.aggregate( { $match : { author : "dave" } } ); the output like:
{ "_id" : objectid("512bc962e835e68f199c8687"), "name" : "dave", "age" : 35 } issues: above sample of actual scenario, want 'age' filed value embedded in double quotes i.e above quoted example should "age": "35".
that full resultant document should following:
{ "_id" : objectid("512bc962e835e68f199c8687"), "name" : "dave", "age" : "35" } consider have huge number of documents how efficiently can achieve same desired output?
question: can out bright , efficient way achieve same?
Comments
Post a Comment