mongoosejs / mongoose-double

Provides Double support for mongoose.js
MIT License
18 stars 13 forks source link

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

Open byteab opened 4 years ago

byteab commented 4 years ago

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,
})
kaeferfreund commented 3 years ago

Same here...

kaeferfreund commented 3 years ago

solved by using decimal128

MattLJoslin commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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.