I try to dvp my first micro service by using grpc and shema mongoose as technologies.
I try to get a specific object and send it to the client(as a front) But it returns only the empty fields.
THis is my code:
const comment=await Comment.find({comment_id:call.request.id}).exec();
if(comment){
console.log(comment);
callback(null,{comment});
}else {
callback({
code: grpc.status.NOT_FOUND,
details: "Not found the comment"
})
}
what it returns when I run the server is:
[
{
interesting_comment: [],
children: [],
_id: 600fe05c0421114ab935d75f,
comment_id: '2',
author_id: '2',
content: 'hello toto',
creation_date: 2021-01-26T09:26:52.141Z,
updated_content_list: [],
__v: 0
}
]
and what I get in the client is:
{
comment: { interesting_comment: [], updated_content_list: [], children: [] }
}
question from:
https://stackoverflow.com/questions/65920267/how-to-return-the-full-object-in-shema-mongoose 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…