I have a problem when I’m creating a new document and saving it to the database, it’s saving the document with wrong data even if the data collected is a specific value set to. I used Mongodb for about 2 years but this is the first time it’s happening to me.
Here is the data that should be stored in the database:
The problem appears on “roleID” which it should be just like in picture, “565193939435388948” (This picture is the data collected, not the data from document inserted.).
And below this is the information that I receive when the document is inserted in database:
As you can see, in the picture, on variable “RoleID”, there is not the same id as in the first picture of the data collected.
(Note: In case anyone says the roleID isn’t string as above, it’s because I took the second picture after tried last time to see if it may work after being converted to number but it doesn’t and just left it like that. being string or number doesn’t change the fact that it’s not saving the data correctly as it was collected.)
Practically, from my research, if the number is bigger than 16 characters long, the last 2 characters are like set to 0. I tried to insert a document with 16 characters, it was inserted with the exact data collected. If it’s 17 or 18, the last 2 digits are set to 0.
This is how the code looks like:
As well as the Schema form used:
I have used mongodb these 2 years only on windows 7. I have updated recently my pc to windows 10 (not personal choice unfortunately…) and I got this problem. Is because of windows 10?
Just to make sure, I’ll say again:
Windows version: Windows 10
Mongodb server version: 4.2.8
Can someone guess what is going on? I really like mongodb and I don’t wanna give up on it after I spent so much time learning it.