javascript - Remove _id from output and nested element in Mongo -
with .findone function i'm getting response:
{ "_id": "59955bb0cd522a00bcaab08c", "lang": "en", "__v": 0, "message_subsets": [ { "identifier": "errors", "_id": "59955bb0cd522a00bcaab08d", "messages": [ { "identifier": "invalid", "message_text": "$field$ invalid", "_id": "59955bb0cd522a00bcaab091" }, { "identifier": "empty", "message_text": "$field$ required", "_id": "59955bb0cd522a00bcaab090" } ] } ] }
is there way exclude _id output , nested elements .findone query parameters?
i'm not 100% sure on this, think mongo returns id in find query, try:
query.findone({_id: queryid}).select("-_id")
i haven't tested this, , not sure if work. worth try ;-)
Comments
Post a Comment