Similar content query

Hi , I am a Designer who is developing my own portifolio using primisc using Express.js, pug and Prismic.

I have a question about how to query related content according to my needs. I am dividing my portfolio into projects where I register each one of my works, at the end of each project there is a suggestion for the user to consult the next project, projects can be related randomly or by similarity (any means is fine for me).

My only precaution is that it does not suggest the same project that the user is seeing, so that it is not repeated, I created this code so that this does not happen.

app.get('/projects/:uid', async (req, res) => {
  try {
    const api = await initApi(req);
    const project_intern = await api.getByUID('project', req.params.uid);
    const meta_data = await api.getSingle('meta_data')

    // similar content query
		const similar_content = await api.getSingle('project', Prismic.filter.not( req.params.uid))

    console.log('dados consolidados:', {similar_content})

    res.render('pages/projects', { project_intern, meta_data, similar_content });
  } catch (error) {
    console.error('Erro ao obter dados do Prismic:', error)

    // in case of errors

    res.status(500).send('Erro interno ao processar a solicitação.')

However, when making a query with this code, Prismic always query the first project, is there any simple way to solve this problem?

Project Git
My Repository

Hi @cristiano.unk. The getSingle query helper method will always return the first project. What you need to use is the get method.

That, combined with the similar filter, should get you what you're looking for.