Skip to content

Commit 6493a96

Browse files
authored
Change schema value type from String to Date
1 parent 510e622 commit 6493a96

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/schematypes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ Union types work with queries and updates. Mongoose casts query filters and upda
814814
const schema = new Schema({
815815
value: {
816816
type: Schema.Types.Union,
817-
of: [Number, String]
817+
of: [Number, Date]
818818
}
819819
});
820820

@@ -829,7 +829,7 @@ doc.value; // 42
829829
// Update
830830
await Model.findOneAndUpdate(
831831
{ value: 42 },
832-
{ value: 'hello' }
832+
{ value: new Date('2025-06-01') }
833833
);
834834
```
835835

0 commit comments

Comments
 (0)