※ Important ※--introduce my environment: MongoDB "win32-x86_64-2008plus-ssl-3.0.5", Mongovue version is 1.6.9,vs2010,dll is 1.10 version.
Uploading of files in MongoDB
Test ①: use vue upload, {Local file name is the same, but the file content is different}, in Vue directly click "Add files" upload file, at this time Vue will check your file name is repeated, if repeated will give a hint "is the name change?" or skip it? Here we click on ' Rename ' to upload the file, which can be seen in Vue: {The first three are the one I uploaded with Vue}
The first two files, although different in content [MD5 values], still do not allow the same name, while the 2nd and 3rd files have different names but are the same picture [MD5 value];
My understanding here is that when I manage MongoDB in vue, "file name does not allow the same and does not require content" when uploading files.
test ②: upload with the program, at this time what also do not prompt, file upload successfully; The following is a comparison:
The names of the 3rd, 4, 5 files are all the same, but the 3rd, 4 files have the same MD5 value, then the 4th, 5 files, although the name is the same, but the MD5 value is different "same name but different content".
My understanding here is that the program will not be on the upload to determine whether the file is the same name, only through the DLL library to complete the file upload, the remaining by MongoDB to judge "different file MD5 different"
Summary: Here I would like to express how to guarantee the uniqueness of the file in MongoDB, in order to determine the name of a file when you are looking for it from the outside. The above comparison is not difficult to find: The file name and MD5 values are not guaranteed MongoDB files unique, what should be used to guarantee it? The answer is that the objectid of the file is the "key-value pair" _id "and its value" in the Bosn, which is displayed in the Vue with the mouse resting on a piece of data, and the value of the 1th key "_id" for each file is different. I will no longer stickers, you can upload a few files themselves to see.
There is, of course, one more place to note, although the Objectid of the file is unique in this MongoDB, but MongoDB's Objectid generation method uses [timestamp, machine, PID, counter] instead of GUID, So the objectid here is not the only one in the world (or the only one in the universe), and cannot be used as the primary key for a library like Oracle.
"First write, May express unclear, I hope you forgive me." What's wrong? Welcome to Point and discuss "
Questions about the uniqueness of files in the MongoDB database