Skip to content

FakeNameGenerator's Bulk Identities' CSV Issue

I was using FakeNameGenerator's bulk generated data in order to accomplish some big data related work. While importing the CSV file into MongoDB I ran into a peculiar issue: one of the keys wasn't recognized at all.

I ran db.runCommand({distinct: "customers", key: "Number"}) and it would show 0 results, even though I can see Number listed as a key while running db.customers.findOne( ). It got me puzzled. I tried to check to see if there was  an issue with the type of the field, if the key was in unicode and contained some other unseen characters, tried renaming the field and so on, but it didn't make any difference.

IntelliJ kept showing the error "The key 'Number' could not be found in this document or array". There was no problem with the code, I was sure as it was MongoDB itself that was not recognizing the key.

FakeNameGenerator Bulk Data

Not sure if this is an issue in Mac OS or Windows as well, but the default CSV file that you download from FakeNameGenerator's Bulk Identity Generator might trouble you the same way. The solution to this is to save the file as a Windows Comma Separated Value format.

Open up the file and on the Save As dialogue, select Windows Comma Separated (.csv) from the File Format dropdown list.

Import the new CSV into MongoDB aaaaaaand problem solved.

Published inHow To'sMisc

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *