Check types

This commit is contained in:
Adria Navarro 2025-01-30 11:33:58 +01:00
parent 42eefddd5c
commit cfba775636
1 changed files with 11 additions and 29 deletions

View File

@ -674,7 +674,7 @@ if (descriptions.length) {
nestedString: "nested", nestedString: "nested",
nestedNumber: 99, nestedNumber: 99,
}, },
dateField: { $date: "2025-01-30T12:00:00Z" }, dateField: new Date(Date.UTC(2025, 0, 30, 12, 30, 20)),
// timestampField: new BSON.Timestamp({ t: 1706616000, i: 1 }), // timestampField: new BSON.Timestamp({ t: 1706616000, i: 1 }),
binaryField: new BSON.Binary( binaryField: new BSON.Binary(
new TextEncoder().encode("bufferValue") new TextEncoder().encode("bufferValue")
@ -702,7 +702,12 @@ if (descriptions.length) {
collection, collection,
}, },
}, },
transformer: "return data.map(x => ({ ...x }))", transformer: `return data.map(x => ({
...x,
binaryField: x.binaryField?.toString('utf8'),
decimalField: x.decimalField.toString(),
longField: x.longField.toString()
}))`,
}) })
const result = await config.api.query.execute(query._id!) const result = await config.api.query.execute(query._id!)
@ -719,7 +724,7 @@ if (descriptions.length) {
nested: true, nested: true,
}, },
], ],
binaryField: "YnVmZmVyVmFsdWU=", binaryField: "bufferValue",
booleanField: true, booleanField: true,
codeField: { codeField: {
code: "function() { return 'Hello, World!'; }", code: "function() { return 'Hello, World!'; }",
@ -730,34 +735,11 @@ if (descriptions.length) {
x: 10, x: 10,
}, },
}, },
dateField: "2025-01-30T12:00:00.000Z", dateField: "2025-01-30T12:30:20.000Z",
decimalField: { decimalField: "12345.6789",
bytes: {
"0": 21,
"1": 205,
"10": 0,
"11": 0,
"12": 0,
"13": 0,
"14": 56,
"15": 48,
"2": 91,
"3": 7,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0,
},
},
doubleField: 42.42, doubleField: 42.42,
integerField: 123, integerField: 123,
longField: { longField: "9223372036854775807",
high: 2147483647,
low: -1,
unsigned: false,
},
maxKeyField: {}, maxKeyField: {},
minKeyField: {}, minKeyField: {},
nullField: null, nullField: null,