Replies: 1 comment
-
As a subdocument. You can disable |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a NestJs code where a schema is defined like below:
`
import { Prop, raw, Schema } from "@nestjs/mongoose";
import { Document } from "mongoose";
import { ObjectId } from "mongodb";
import { CSharpDate, CSharpDateInterface } from "./utils";
@Schema()
export class UserConsent extends Document {
@prop({ required: true })
UserAccountId!: string;
}
`
and the CSharpDate type and CSharpDateInterface are defined as below (note that the CSharpDate does not have a @Schema() decorator on it):
`export interface CSharpDateInterface {
DateTime: Date;
Ticks: number;
Offset: number;
}
export const CSharpDate = {
DateTime: Date,
Ticks: Number,
Offset: Number,
};`
My question here: will the CreatedAt property be treated as "Subdocument" or "Nestedpath" by Mongoose? And why would it contain an "_id" field when saved into database collection?
Beta Was this translation helpful? Give feedback.
All reactions