在我的dotnet核心项目中,返回像波纹管这样的mongodb数据
实际结果:
{
"obj":{
"value": "[{ \"_id\" : ObjectId(\"5c67fbdeacb7e0d82daab871\"), \"name\" : \"NewPatient\", \"description\" : \"\", \"targeturl\" : \"http://sub.domain.in", \"active\" : true, \"createddate\" : ISODate(\"2019-02-16T06:10:20.201Z\"),{ \"_id\" : ObjectId(\"5c67fbdeacb7e0d82daab870\"), \"name\" : \"NewPatient\", \"description\" : \"\", \"targeturl\" : \"http://sub.domain.in", \"active\" : true, \"createddate\" : ISODate(\"2019-02-16T06:10:20.201Z\")]"
},
"value": 1,
"info": " Retrived Successfully"
}
但预期结果是
{
"obj":{
"value": [{ "_id" :"5c67fbdeacb7e0d82daab871), "name" : "NewPatient", "description" : "", "targeturl" : "http://sub.domain.in", "active" : true, "createddate" : "2019-02-16T06:10:20.201",{ "_id" : "5c67fbdeacb7e0d82daab870", "name" : "NewPatient", "description" : "", "targeturl" : "http://sub.domain.in", "active" : true, "createddate" : "2019-02-16T06:10:20.201Z"}]
},
"value": 1,
"info": " Retrived Successfully"
}
操作方法。我的代码如下所示
var doc = Collection.Find(new BsonDocument()).ToEnumerable();
report.Add("value",doc.ToJson());
returnData.Add("obj",report);
returnData.Add("value",1);
returnData.Add("info","Reports Retrived Successfully");
请任何人尝试帮助我。
谢谢...