Remove "_id" fields from /api/lang endpoint

This commit is contained in:
Aelita4 2024-11-02 19:14:08 +01:00
parent a12b82f470
commit 91cafb2bf3
Signed by: Aelita4
GPG Key ID: E44490C2025906C1
1 changed files with 6 additions and 6 deletions

View File

@ -3,11 +3,11 @@ import { Lang } from "./mongodb";
export const getLang = async (language = "en") => { export const getLang = async (language = "en") => {
const lang = await Lang(language); const lang = await Lang(language);
return { return {
general: await lang[0].find({}).toArray(), general: (await lang[0].find({}).toArray()).map(({ _id, ...rest }) => rest),
buildings: await lang[1].find({}).toArray(), buildings: (await lang[1].find({}).toArray()).map(({ _id, ...rest }) => rest),
ships: await lang[2].find({}).toArray(), ships: (await lang[2].find({}).toArray()).map(({ _id, ...rest }) => rest),
resources: await lang[3].find({}).toArray(), resources: (await lang[3].find({}).toArray()).map(({ _id, ...rest }) => rest),
research: await lang[4].find({}).toArray(), research: (await lang[4].find({}).toArray()).map(({ _id, ...rest }) => rest),
structures: await lang[5].find({}).toArray() structures: (await lang[5].find({}).toArray()).map(({ _id, ...rest }) => rest)
} }
} }