1 00:00:02,610 --> 00:00:08,190 Now before exploring all these exciting types you saw in the previous slide, there is something important 2 00:00:08,190 --> 00:00:11,010 I need to highlight about numbers in the mongo shell. 3 00:00:11,220 --> 00:00:16,410 The mongo shell is based on Javascript, it's basically implemented in javascript 4 00:00:16,410 --> 00:00:23,370 you could say and therefore it follows some default javascript just has well inherit and one of that 5 00:00:23,370 --> 00:00:31,470 is that a number like 64 by default in javascript is not stored as an integer or treated as an integer 6 00:00:31,530 --> 00:00:33,870 but as a 64 bit float, 7 00:00:33,870 --> 00:00:37,120 so as a double. This is just a default in Javascript, 8 00:00:37,170 --> 00:00:42,600 so this number and this number are essentially the same in Javascript, behind the scenes they will be 9 00:00:42,600 --> 00:00:47,940 stored in something like this, with some kind of imprecision at some point, doesn't have to be a two 10 00:00:47,970 --> 00:00:53,430 at exactly this place but it will have some imprecision because it's a 64 bit float. 11 00:00:53,430 --> 00:01:01,350 This is how it works in javascript and therefore, if I just use a dummy collection, num test, whatever 12 00:01:01,350 --> 00:01:06,270 you want to use and then insert one value in there with A1, 13 00:01:06,270 --> 00:01:13,170 since I'm doing this from within the mongo shell, this one will be inserted into mongodb as a double 14 00:01:13,320 --> 00:01:17,630 not as this 128 bit high precision decimal, 15 00:01:17,640 --> 00:01:20,040 we'll have a look at that in this module 16 00:01:20,130 --> 00:01:22,860 but as a 64 bit float double. 17 00:01:23,100 --> 00:01:24,950 So this is how it will be inserted, 18 00:01:24,960 --> 00:01:31,890 it will not be inserted as an int 32 and I highlight this because this is really just inherent to the mongo 19 00:01:31,890 --> 00:01:37,650 shell because it's based on Javascript, you would face the exact same behavior when working with nodejs 20 00:01:37,700 --> 00:01:40,000 in the mongo driver there 21 00:01:40,260 --> 00:01:47,310 but for other languages and their drivers, let's say for python, this will differ. In Python, a value like 22 00:01:47,310 --> 00:01:52,010 this would be an integer and a value like this would be a float, 23 00:01:52,140 --> 00:01:58,930 so python does differentiate and therefore there, this would be inserted as a double into mongodb, 24 00:01:58,950 --> 00:02:02,220 so will be stored as a normal double in the database, 25 00:02:02,220 --> 00:02:05,430 this would be inserted as an int 32 26 00:02:05,670 --> 00:02:07,600 and this will be important to understand. 27 00:02:07,720 --> 00:02:16,250 Now I will later in the from shell to driver module show you how to write code with a 28 00:02:16,260 --> 00:02:22,440 mongodb driver in a real application and I will show you how you can get a feeling for what is 29 00:02:22,460 --> 00:02:23,310 supported, 30 00:02:23,310 --> 00:02:25,270 which types do I have to convert 31 00:02:25,410 --> 00:02:31,290 but you also always have to know the language you're working in and you have to know the defaults for 32 00:02:31,290 --> 00:02:35,260 this language. Does it differentiate between integers and doubles? 33 00:02:35,280 --> 00:02:37,740 If yes, what is the default integer, 34 00:02:37,770 --> 00:02:39,280 is it an int 32 35 00:02:39,420 --> 00:02:44,420 and then you will know do I need to convert it as we will do it in this module 36 00:02:44,490 --> 00:02:51,510 because for the shell which is based in javascript, we will have to explicitly create an int 32 because 37 00:02:51,600 --> 00:02:56,760 this is not one as I just explained, for other languages this will not be required 38 00:02:56,910 --> 00:02:59,840 and this is just one important thing you have to keep in mind 39 00:02:59,940 --> 00:03:07,530 for the language you're working with. The from shell to driver module should make it clearer how you can 40 00:03:07,530 --> 00:03:09,530 write code and how you can create 41 00:03:09,540 --> 00:03:13,590 let's say that 64 bit int in your driver code. 42 00:03:13,650 --> 00:03:15,450 So you will learn that later in the course 43 00:03:15,450 --> 00:03:16,110 no worries, 44 00:03:16,200 --> 00:03:21,550 I just want to highlight that the default which gets written into mongodb 45 00:03:21,570 --> 00:03:23,660 does not depend on mongodb 46 00:03:23,760 --> 00:03:28,260 but on the client you're using, in the shell it's based on Javascript, 47 00:03:28,290 --> 00:03:30,900 so the default is the 64 bit double.