diff options
Diffstat (limited to 'src/database.ts')
-rw-r--r-- | src/database.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/database.ts b/src/database.ts index 2cbab72..5ede904 100644 --- a/src/database.ts +++ b/src/database.ts @@ -1167,14 +1167,14 @@ export async function updateItemAuction(auction: ItemAuctionsSchema) { /** * Fetches the SkyBlock ids of all the items in the auctions database. This method is slow and should be cached! */ -export async function fetchItemsAuctionsIds(): Promise<string[] | undefined> { +export async function fetchItemsAuctionsIds(skyblockIds: boolean = false): Promise<string[] | undefined> { if (!itemAuctionsCollection) return undefined const docs = await itemAuctionsCollection?.aggregate([ { $sort: { oldestDate: -1 } }, // this removes everything except the _id - { $project: { _id: true } } + { $project: skyblockIds ? { _id: false, sbId: true } : { _id: true } } ]).toArray() - return docs.map(r => r._id) + return skyblockIds ? docs.filter(r => r.sbId).map(r => r.sbId) : docs.map(r => r._id) } |