aravindnc/mongoose-paginate-v2

$or query is not working

zayn-m opened this issue · 2 comments

I'm writing $or query but it returns empty results.

const { user } = req;
  user.id = '613706dd3661d31d5c05255d';
  const query = {
    $or: [{ buyer: user.id }, { 'oikos.user': user.id }],
  };
  const options = {
    populate: {
      path: 'oikos',
      match: { user: user.id },
    },
  };
  const transactions = await Transaction.paginate(query, options);;
  return transactions;

Can you please confirm that the query runs without paginate plugin?

Feel free to reopen if this is a plugin issue.