@@ -654,16 +654,16 @@ typeof question.answer; // 'bigint'
654
654
### Double {#double}
655
655
656
656
Mongoose supports [ 64-bit IEEE 754-2008 floating point numbers] ( https://en.wikipedia.org/wiki/IEEE_754-2008_revision ) as a SchemaType.
657
- Int32s are stored as [ BSON type "double" in MongoDB] ( https://www.mongodb.com/docs/manual/reference/bson-types/ ) .
657
+ Doubles are stored as [ BSON type "double" in MongoDB] ( https://www.mongodb.com/docs/manual/reference/bson-types/ ) .
658
658
659
659
``` javascript
660
- const studentsSchema = new Schema ({
661
- id : Double
660
+ const temperatureSchema = new Schema ({
661
+ celsius : Double
662
662
});
663
- const Student = mongoose .model (' Student ' , schema );
663
+ const Temperature = mongoose .model (' Temperature ' , temperatureSchema );
664
664
665
- const student = new Temperature ({ celsius: 1339 });
666
- typeof student . id ; // 'number'
665
+ const temperature = new Temperature ({ celsius: 1339 });
666
+ typeof temperature . celsius ; // 'number'
667
667
```
668
668
669
669
There are several types of values that will be successfully cast to a Double.
@@ -688,12 +688,12 @@ Mongoose supports 32-bit integers as a SchemaType.
688
688
Int32s are stored as [ 32-bit integers in MongoDB (BSON type "int")] ( https://www.mongodb.com/docs/manual/reference/bson-types/ ) .
689
689
690
690
``` javascript
691
- const studentsSchema = new Schema ({
691
+ const studentSchema = new Schema ({
692
692
id: Int32
693
693
});
694
- const Student = mongoose .model (' Student' , schema );
694
+ const Student = mongoose .model (' Student' , studentSchema );
695
695
696
- const student = new Temperature ({ celsius : 1339 });
696
+ const student = new Student ({ id : 1339 });
697
697
typeof student .id ; // 'number'
698
698
```
699
699
0 commit comments