是否可以在 javascript 控制台中定义 int32 值?
我是否理解正确,不可能在 mongodb javascript 控制台中定义和存储 int32 值?因此,如果我想这样做,就别无选择,只能用 Java 或其他具有类型良好的驱动程序接口的语言编写程序?
我能找到的唯一或多或少明确的解释是 mongodb JIRA 中的 BUG #854 。但我简直不敢相信这样一个简单而重要的功能竟然被避免了。
Do I understand right that it is impossible to define and store an int32 value in the mongodb javascript console? So if I want to do so a have no choice but to write a program in Java or other language with well-typed driver interface?
The only more or less clear explanation I could find is BUG #854 in mongodb's JIRA. But I just can't believe that such a simple and vital feature is avoided.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更糟糕的是,如果你在 JS 控制台中检索数据然后将其写回到 DB,它会将整数转换为浮点数。
据我所知,解决此问题的新功能尚未实现。新功能在1.9.1中实现:It's even worse than that, if you retrieve data in the JS console and then write it back to the DB, it will convert interegers to floats.
AFAIK the new feature to fix this is still not implemented. The new feature was implemented in 1.9.1:作为更新,以下功能对我来说工作正常。结果字段的类型为 Int32
Just as an update, the following function is working okay for me. The resulting field is of type Int32