热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

我的restapi(.net)发送请求(包括ID)时,即使其值确实存在于数据库中,也会返回错误“无效数据”

对象已发送{..maritalStatus:null,thisisanenum(single,married)

对象已发送

{
..
maritalStatus: null,//this is an enum (single,married...)
..
}

邮递员错误

{
"errors": {
"id": [
"The value '5db2b8d4cc354xxxxxx' is not valid."
],"maritalStatus": [
"Error converting value {null} to type 'myProject_Core.MaritalStatus'. Path 'maritalStatus',line 6,position 19."
]
},"title": "One or more validation errors occurred.","status": 400,"traceId": "80000009-0003-fe00-b63f-84710c7967bb"
}

我正在使用 mongo db ,其中ID被保存为ObjectId("5db2b8d4cc354xxxxxx"),但是当我处理数据时,我不再需要使用ID来保存ID。

>



推荐阅读
author-avatar
cryy5bl-1940
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有