This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const client = await MongoClient.connect('mongo-url', { | |
| // perf optimization - https://github.com/mongodb/node-mongodb-native/releases/tag/v4.3.0 | |
| enableUtf8Validation: false, | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| db.assets.find({ | |
| marketCap: { $gt: 10000 } | |
| }, { | |
| projection: { isin: 1 } | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "_id": "1232312323", | |
| "name": "Apple", | |
| "isin": "US123456890", | |
| "marketCap": 1233413233.123, | |
| "ipoDate": "2000-01-01", | |
| "lastPrice": 123.23, | |
| "dividends": [ | |
| { | |
| "date": "2022-01-01", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async timestampCreateSeries({ | |
| key, | |
| retentionInSeconds, | |
| labels, | |
| }: { | |
| key: string; | |
| retentionInSeconds: number; | |
| labels: string[][]; | |
| }) { | |
| const args: (string | number)[] = [key, 'RETENTION', retentionInSeconds, 'DUPLICATE_POLICY', 'LAST']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ProxyAgent } from 'undici'; | |
| const SAFE_HTTP_METHODS = ['GET', 'HEAD', 'OPTIONS']; | |
| const IDEMPOTENT_HTTP_METHODS = SAFE_HTTP_METHODS.concat(['PUT', 'DELETE']); | |
| const HTTP_STATUS_TO_RETRY = [408, 429, 500, 501, 502, 503, 504]; | |
| const DEFAULT_TIMEOUT = 20_000; | |
| const retryDenyList = new Set([ | |
| 'ENOTFOUND', |
OlderNewer