【发布时间】:2016-12-16 12:23:23
【问题描述】:
我刚刚注意到,每当使用预定义变量在 MongoDB 中保存任何内容时,数据类型都会从 Number 和 Boolean 更改为 String
Orders = new Mongo.Collection("Orders");
Orders.update({_id:"12345"},{$set:{price:5.5}) //this works
var price = {price: 5.5};
Orders.update({_id:"12345"},{$set:price}); //this is not working anymore in the mongo collection price is saved as String "5.5" not as a number, same goes for Boolean values
谁能帮我解决最近发生的事情?将整个应用程序更改为使用第一种方法并不是解决方案,因为我的代码生成了数千个更新,这些更新之前运行良好。
【问题讨论】:
-
你能说明你是如何在流星中定义你的订单模式的吗?
-
新应用程序也会出现这种情况吗?如果没有,你用的是什么包?
标签: string mongodb meteor insert converter