diff options
author | mat <github@matdoes.dev> | 2022-07-02 15:49:52 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-07-02 15:49:52 -0500 |
commit | f6504b6d78547052f5686409724ded181e3d1ded (patch) | |
tree | ede41ffb562f01edf80f6200dc7cdded058f483b | |
parent | 96671eaaa92d2f0b508589a0cd372618d94c7fad (diff) | |
download | skyblock-api-f6504b6d78547052f5686409724ded181e3d1ded.tar.gz skyblock-api-f6504b6d78547052f5686409724ded181e3d1ded.tar.bz2 skyblock-api-f6504b6d78547052f5686409724ded181e3d1ded.zip |
mongodb treats undefined as null
-rw-r--r-- | src/database.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/database.ts b/src/database.ts index 4d2eb4d..d513256 100644 --- a/src/database.ts +++ b/src/database.ts @@ -1135,10 +1135,12 @@ function toItemAuctionsSchemaBson(i: ItemAuctionsSchema): ItemAuctionsSchemaBson _id: i.id, sbId: i.sbId, auctions: i.auctions.map(a => { - return { + const newA: SimpleAuctionSchemaBson = { ...a, bin: a.bin ? true : undefined } + if (newA.bin === undefined) delete newA.bin + return newA }), // we sort by oldestDate to get the volume sold, but we don't want brand new items with like no data having a high frequency oldestDate: i.auctions.length > 10 ? i.auctions[0]?.ts ?? 0 : 0 |