-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: insertMany fails on Decimal Types #5190
Comments
thanks for the full repro script, this looks like a bug |
it looks like the mongoose
i believe in mongo it should be setting it as Decimal128 or
|
I am getting this same error, when I install my node dependencies with MyModel.create({
...
"price": {
"$numberDecimal": "9.99"
}
...
}); And this is the model descriptor: {
...
"attributes": {
...
"price": {
"type": "decimal"
},
...
}
} (strapi creates this schema for me, so I don't know if it is directly compatible with mongoose description of a model, or it's a layer of abstraction on top of it) mongoose seems to be latest (v5.4.6). (it's myProj -> dep -> dep -> mongoose, so at least that's fortunate in this situation) MongoDB: I've tested only with 3.4.1 (official kubernetes helm chart, I am not sure on what OS base image is the bitnami/mongodb 3.4.1 building on) and 3.6.3 (os x 10.13.6) and the issue reproduced in both places. |
@nicroto can you provide code samples for how you're using strapi to generate this? Also, you're not experiencing the exact same issue, |
Thanks for the reply @vkarpov15. It was strapi's fault. They were setting the type to float instead of decimal and the create wasn't able to parse the value. |
When using insertMany on a model whose schema contains a Decimal type, the operation fails with the error:
Error: key $numberDecimal must not start with '$'
Steps to reproduce:
The following code reproduces the issue:
Current Behavior:
The insert operation fails with the error:
Error: key $numberDecimal must not start with '$'
Expectation:
I expect the documents passed to insertMany to be inserted into MongoDB.
Versions:
Mongoose v4.9.5
MongoDB v3.4.3
Node v6.9.1
The text was updated successfully, but these errors were encountered: