Optional
_idShould subdocuments get their own id?
true (Implicitly)
Optional
addAdd "null" to the enum array Note: Custom Typegoose Option
Optional
aliasGive the Property an alias in the output
Note: you should include the alias as a variable in the class, but not with a prop decorator
class Dummy {
@prop({ alias: "helloWorld" })
public hello: string; // normal, with @prop
public helloWorld: string; // is just for type Completion, will not be included in the DB
}
Optional
allowSet Custom "warnMixed" Severity for a specific property Overwrites Severity set in "modelOptions" for a specific property Note: Custom Typegoose Option
Optional
autoIf true, uses Mongoose's default _id
settings. Only allowed for ObjectIds
Note: Copied from mongoose's "index.d.ts"#SchemaTypeOptions
Optional
autopopulateThis option as only an effect when the plugin mongoose-autopopulate
is used
Optional
defaultGive the Property a default Value
Optional
discriminatorsSet the Nested Discriminators
Note: "_id: false" as a prop option doesn't work here
Note: Custom Typegoose Option
Optional
enumOnly accept Values from the Enum(|Array)
Optional
message?: stringOptional
excludeIf true
, Mongoose will skip gathering indexes on subpaths. Only allowed for subdocuments and subdocument arrays.
Note: Copied from mongoose's "index.d.ts"#SchemaTypeOptions
Optional
expiresShould this property have an "expires" index?
Optional
getSet a Getter (Non-Virtual) to Post-process your value
(when using get/set both are required)
Please note that the option type
is required, if get/set saves a different value than what is defined
The Value that needs to get modified
Optional
doc: SchemaTypeOptions<any, any>Optional
The Value, but modified OR anything
function setHello(val: string): string {
return val.toLowerCase()
}
function getHello(val: string): string {
return val.toUpperCase();
}
class Dummy {
@prop({ set: setHello, get: getHello }) // many options can be used, like required
public hello: string;
}
Optional
immutableMake a property read-only
class SomeClass {
@prop({ immutable: true })
public someprop: Readonly<string>;
}
Optional
indexShould this property have an index? Note: don't use this if you want to do a compound index
Optional
innerUse this to define inner-options Use this if the auto-mapping is not correct or for plugin options
Please open a new issue if some option is mismatched or not existing / mapped
Optional
ofUse option BasePropOptions.type
Optional
outerUse this to define outer-options Use this if the auto-mapping is not correct or for plugin options
Please open a new issue if some option is mismatched or not existing / mapped
Optional
refReference another Document (you should use Ref
Optional
refTake the Path and try to resolve it to a Model
Optional
requiredis this value required?
false (Implicitly)
Optional
selectinclude this value?
true (Implicitly)
Optional
setSet a Setter (Non-Virtual) to pre-process your value
(when using get/set both are required)
Please note that the option type
is required, if get/set saves a different value than what is defined
The Value that needs to get modified
Optional
priorVal: anyOptional
Optional
doc: SchemaTypeOptions<any, any>Optional
The Value, but modified OR anything
function setHello(val: string): string {
return val.toLowerCase()
}
function getHello(val: string): string {
return val.toUpperCase();
}
class Dummy {
@prop({ set: setHello, get: getHello }) // many options can be used, like required
public hello: string;
}
Optional
sparseShould this property have a "sparse" index?
Optional
subtypeThe default subtype associated with this buffer when it is stored in MongoDB. Only allowed for buffer paths
Note: Copied from mongoose's "index.d.ts"#SchemaTypeOptions
Optional
textShould this property have a "text" index?
Optional
transformDefine a transform function for this individual schema type.
Only called when calling toJSON()
or toObject()
.
Note: Copied from mongoose's "index.d.ts"#SchemaTypeOptions
Optional
typeThis may be needed if get/set is used (this sets the type how it is saved to the DB)
Optional
uniqueShould this property have a "unique" index?
Optional
validateGive a Validator RegExp or Function
Generated using TypeDoc
Options For Map's