[英]Seem like i can't handle response from mongodb when using hyphen in field name
I didn't see any recommendation about using hyphen in field name at all我根本没有看到任何关于在字段名称中使用连字符的建议
Even with @serialName
it still didn't work即使使用
@serialName
它仍然不起作用
@SerialName("created-date")
val created_date: String,
but It worked fine with underscore (now i'm using it)但它下划线工作正常(现在我正在使用它)
The reason i used it in the first place is because I have used a few api and most of them used hyphen and i just want to follow the common name.我首先使用它的原因是因为我使用了一些api,其中大部分使用了连字符,我只想遵循通用名称。
If anyone know why please kindly tell me.如果有人知道为什么请告诉我。 I might be missing any docs or sth
我可能会遗漏任何文档或某事
There is a page in MongoDB documentation, I'm putting a shortcut for restrictions based on field names https://docs.mongodb.com/manual/reference/limits/#mongodb-limit-Restrictions-on-Field-Names . MongoDB 文档中有一个页面,我将基于字段名称的限制设置快捷方式https://docs.mongodb.com/manual/reference/limits/#mongodb-limit-Restrictions-on-Field-Names 。
MongoDB can store various different field names even you can have "space" in field name. MongoDB 可以存储各种不同的字段名称,即使字段名称中可以有“空格”。 It is not a problem for MongoDB, but once your application receives MongoDB output, it should be deserialized.
这对 MongoDB 来说不是问题,但是一旦您的应用程序收到 MongoDB 输出,就应该对其进行反序列化。 I have never used kotlinx.serialization before;
我以前从未使用过 kotlinx.serialization; hence I'm just guessing.
因此我只是猜测。 What if the problem might be coming from serialization/deserialization process.
如果问题可能来自序列化/反序列化过程怎么办。 You better check kotlinx.serialization, maybe something is there.
你最好检查 kotlinx.serialization,也许那里有什么东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.