Indexing Referenced Schemas
- Dominant language
- JavaScript
- Stars
- 61
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
I have a mongoose schema that references a 'User' schema. I'd like certain fields to be indexed into Algolia like the users name, and a few other fields, but the problem is that all of the attributes within user are being sent over to Algolia, including things like the hashed password (which I don't want indexed). Is it currently possible to tell Mongolia to not index certain fields within referenced documents?
```js
const EventSchema = new mongoose.Schema({
name: { type: String, required: true, algoliaIndex: true },
start_at: { type: Date, required: true, algoliaIndex: true },
end_at: { type: Date, required: true, algoliaIndex: true },
user: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
index: true,
algoliaIndex: true
}
});
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing how the EventSchema's referenced User document is serialized and sent to Algolia. Determine how selected fields such as the user's name can be indexed while excluding sensitive fields like the hashed password; done means referenced documents support explicit field selection without indexing excluded attributes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb
- Domain
- databases, search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100