Skip to content
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

double type not working it store int instead of double bson? #10

Open
byteab opened this issue Jun 21, 2020 · 5 comments
Open

double type not working it store int instead of double bson? #10

byteab opened this issue Jun 21, 2020 · 5 comments

Comments

@byteab
Copy link

byteab commented Jun 21, 2020

It stores int type instead of double.

import mongoose, { Schema } from "mongoose"
import Double from "../CustomTypes/Double"
export const ProductVariantEmbeddedSchema = new Schema({
  price: Double,
  discount: Double,
  isAvailable: Boolean,
  quantity: Number,
  maximumToBook: Number,
})
@byteab byteab changed the title not working? double type not working it store int instead of double bson? Jun 21, 2020
@kaeferfreund
Copy link

Same here...

@kaeferfreund
Copy link

solved by using decimal128

@MattLJoslin
Copy link

This still seems to be happening. Any pointers on what to check in this code? I'm fine making a patch if no one is available actively maintaining this.

@MattLJoslin
Copy link

Traced this down to the removal of valueOf. When I add valueOf back, the issue is resolved. I also have a very repeatable example to test with if anyone is interested. Will adding valueOf back break anything?

@abrahamp-hv
Copy link

abrahamp-hv commented Jun 2, 2022

Traced this down to the removal of valueOf. When I add valueOf back, the issue is resolved. I also have a very repeatable example to test with if anyone is interested. Will adding valueOf back break anything?

Hi @MattLJoslin , can you please provide pointers where we need to add valueOf. I am a beginner in this area. It would be of great help if you can share the code snippet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants