Open diathekez opened 1 year ago
I also want to know
The "issue" with the search as it's programmed is that you need to look at the searchUser query inside lib/api/user.ts
to see that it's expecting you to define a search index inside MongoDB Atlas. Additionally, the aggregate function is filtering out users who are not verified, which none are in the sample set that is loaded into the test users database.
Here is how you can get search working locally:
Step 1: Go to this file and look at the commented out code that starts with name-index is a search index as follows
Step 2:
name-index
as shown in the user.ts
file.user.ts
. The analyzer and searchAnalyzer default to the correct valuesStep 3: Getting results The following lines of code filter results using the "verified" field on each user... Astute programmers will notice this field does not exist on the test.users collection... So you have a few options.
[...nextauth].ts
file adds this flag to your MyFirstDatabase.users
collection; however, that is not the collection search is looking over.
Hello. I'm new to TypeScript, and still new to programming in general. Forgive me if the answer is obvious, but how do I enable searching? Or is it already enabled and I just have to tweak some things? Thanks in advance :) Please feel free to DM me.