简体   繁体   English

在字段名称中使用连字符时,似乎我无法处理来自 mongodb 的响应

[英]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.

相关问题 我似乎无法与 mongodb 连接 - I can't seem to connect with mongodb Mongodb:无法使用字符串字段名称追加到数组 - Mongodb: Can't append to array using string field name 如何在 MongoDB 查询中使用带有字符(连字符、句点和冒号)的字段名称? - How do I use a field name with characters (hyphen, period and colon) in MongoDB queries? 使用 stringValue() 或 like() 进行过滤时,带有 MongoDB 的 QueryDSL 无法将属性从 Long 类型序列化为 String - QueryDSL with MongoDB can't serialize property from type Long to String when filtering using stringValue() or like() MongoDB:我似乎无法使用findOne查询匹配项(使用mongoose,mLab) - MongoDB: I can't seem to query matches with findOne (using mongoose,mLab) 似乎无法使用正则表达式使MongoDB find()与PHP一起使用 - can't seem to get MongoDB find() with regex to work using PHP MongoDB 中的项目字段,我不知道中间字段名称 - project field in MongoDB with I don't know intermediates field name MongoDB为什么出现此错误:无法使用字符串字段名称附加到数组:注释 - MongoDB Why this error : can't append to array using string field name: comments 使用Jhipster和Mongodb时我无法添加实体 - I can't add an entity when using Jhipster and Mongodb Mongodb.Bson BsonBinaryWriter 无法写入带名称的字段 - Mongodb.Bson BsonBinaryWriter can't write field with name
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM