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

Fix "Cannot convert a BigInt value to a number" #10

Merged
merged 2 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/service-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"ix": "^5.0.0",
"jose": "^4.15.1",
"lru-cache": "^10.2.2",
"mongodb": "^6.5.0",
"mongodb": "^6.7.0",
"node-fetch": "^3.3.2",
"pgwire": "github:kagis/pgwire#f1cb95f9a0f42a612bb5a6b67bb2eb793fc5fc87",
"ts-codec": "^1.2.2",
Expand Down
3 changes: 0 additions & 3 deletions packages/service-core/src/storage/mongo/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ export class PowerSyncMongo {
this.client = client;

const db = client.db(options?.database, {
// Note this issue with useBigInt64: https://jira.mongodb.org/browse/NODE-6165
// Unfortunately there is no workaround if we want to continue using bigint.
// We selectively disable this in individual queries where we don't need that.
...BSON_DESERIALIZE_OPTIONS
});
this.db = db;
Expand Down
2 changes: 1 addition & 1 deletion packages/service-core/src/storage/mongo/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ export async function readSingleBatch<T>(cursor: mongo.FindCursor<T>): Promise<{
}

export const BSON_DESERIALIZE_OPTIONS: bson.DeserializeOptions = {
// use bigint instead of long
// use bigint instead of Long
useBigInt64: true
};
20 changes: 10 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"ix": "^5.0.0",
"jose": "^4.15.1",
"lru-cache": "^10.0.1",
"mongodb": "^6.5.0",
"mongodb": "^6.7.0",
"node-fetch": "^3.3.2",
"pgwire": "github:kagis/pgwire#f1cb95f9a0f42a612bb5a6b67bb2eb793fc5fc87",
"ts-codec": "^1.2.2",
Expand Down
Loading