-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Concatenated slugs #9
Comments
Hi @FarazPatankar! |
Most of the tests use compound slugs, so I expect it should work. If something doesn't work for you there are two cases:
|
I feel like I am missing something. Here's the code: const JobSchema = new Schema({
title: {
type: String, required: true,
},
slug: {
type: String,
slug: ['title', 'company.name'],
uniqueSlug: true,
},
company: { type: Schema.Types.ObjectId, ref: 'Company' },
}); Shouldn't this add a slug that includes both the job title and the company name? I am only getting the job title as of now. Does it not work because I am referencing another model? Does it only work for subdocuments? |
I've never tested Mongoose |
That's all the code I have actually. I am using Forest Admin to add/update the data. It works fine if I use two fields from the I also tried removing doing it with the |
Well, I can't help you with it right now, refs are not supported yet. In your case i'd recommend to have slug field in each collection, in the job and company separately. |
Hey,
I just found this library and it seems great so far. I had a quick question, would it be possible to concatenate two values to form my slug?
As an example, let's assume I am building a job board and I want the slug to be the job title followed by the company name. Could I do something like
slug: 'title', 'at', 'company.name'
.Thanks!
The text was updated successfully, but these errors were encountered: