Php uses the update method in the mongo driver to insert 8 data into an integer array (the array is like this, list: [, 4]) and converts it to numberlong (8 ). Converting 8 to the two classes defined in the driver: Optional int32 and optional int64 is also incorrect. The displayed numberint (8 )... php uses the update method in the mongo driver to insert 8 data into an integer array (the array is like this, list: [, 4]) and converts it to numberlong (8 ).
Converting 8 to the two classes defined in the driver: Optional int32 and optional int64 is also incorrect. At this time, numberint (8) and numberlong (8) are displayed ).
There is no problem with inserting in mongo shell, which is 8.
Thank you.
Reply content:
Php uses the update method in the mongo driver to insert 8 data into an integer array (the array is like this, list: [, 4]) and converts it to numberlong (8 ).
Converting 8 to the two classes defined in the driver: Optional int32 and optional int64 is also incorrect. At this time, numberint (8) and numberlong (8) are displayed ).
There is no problem with inserting in mongo shell, which is 8.
Thank you.
It's not clear what type of data you actually need
Insert an integer of 8NumberInt (8)
Isn't it normal?
In mongo shell, the number is of the double type by default.
$ Type-MongoDB Manual 3.2
For example, if you want to insert the number 8, you can findDouble
Type (that is, $ type is 1) of the document, findTest_doc
Db. collection_example.insert ({_ id: 'test _ doc ', num: 8}) db. collection_example.find ({num: {$ type: 1 }})