games-express-api/utils/getTag.js

12 lines
276 B
JavaScript
Raw Permalink Normal View History

2024-09-12 15:48:27 -04:00
import Game from '../models/Game.js'
const getTag = async (tag) => {
const fullTags = await Game.find().distinct(tag)
let tags = []
for (let i = 0; i < fullTags.length; i++) {
if (fullTags[i] !== '') tags.push(fullTags[i])
}
return tags
}
export default getTag