Cannot read property '_id' of undefined

Hello everyone. I have just started learning MongoDb. and I have a kinda problem.I created db ,created collection and now I want to import my log file but I’m encountering this error: Cannot read property ‘_id’ of undefined
the content of my files are like that.
all records have same format.I dont understand why I’m encountering this error?If you help me ı would be grateful

Welcome to the MongoDB Community Forums @furkan_eren !

It looks like you are importing a JSON file. Can you provide some more details on how you are importing this:

  • specific version of MongoDB tool or driver used
  • command-line options or snippet of code for the import
  • any steps that might help someone reproduce this error

JSON files are often imported using a GUI like MongoDB Compass (which has a feature to Import and Export Data) or the command-line mongoimport tool.

Regards,
Stennie

1 Like

Thanks for your answer. I use MongoDB 4.4.6 Community edition . I also use MongoDbCompass for importing process but there is a problem here . I can’t send more photo in here because I’m new user and system does not allow me to share a photo.

Hi @furkan_eren ,

It is preferable to share a text snippet (for example, a JSON document to import if the data isn’t confidential) so that someone is able to try to reproduce the issue.

The specific version of Compass you are using as well as the steps you are taking would also be helpful information.

Thanks,
Stennie

{“DATE”:“2021-05-01 02:20:57.9671”,“REPORT_ID”:“674a82c5-200a-497a-9c01-0c951c991c6a”,“APP_VERSION_CODE”:1,“APP_VERSION_NAME”:“3.64”,“PACKAGE_NAME”:“tr.gov.iski.ortaksayacokuma”,“FILE_PATH”:“/data/user/0/tr.gov.iski.ortaksayacokuma/files”,“PHONE_MODEL”:“ASUS_X00ID”,“BRAND”:“asus”,“PRODUCT”:“WW_Phone”,“ANDROID_VERSION”:“8.1.0”,“BUILD”:{“ASUSCID”:“ASUS”,“ASUSSKU”:“WW”,“AUTO_START”:true,“BOARD”:“ASUS_X00ID”,“BOOTLOADER”:“unknown”,“BRAND”:“asus”,“CHARACTERISTICS”:“nosdcard”,“COUNTRYCODE”:“WW”,“CPU_ABI”:“arm64-v8a”,“CPU_ABI2”:“”,“CTA”:false,“CTA_APP”:false,“CTA_IMAGE”:false,“CTA_OS”:false,“DEVICE”:“ASUS_X00IDB”,“DISPLAY”:“OPM1.171019.011.WW_Phone-15.2016.1907.519-0”,“FINGERPRINT”:“asus/WW_Phone/ASUS_X00IDB:8.1.0/OPM1.171019.011/15.2016.1907.519-0:user/release-keys”,“HARDWARE”:“qcom”,“HOST”:“ubuntu”,“ID”:“OPM1.171019.011”,“ISASUSCNSKU”:false,“ISASUSVERMAX”:false,“IS_CONTAINER”:false,“IS_DEBUGGABLE”:false,“IS_EMULATOR”:false,“IS_ENG”:false,“IS_TREBLE_ENABLED”:false,“IS_USER”:true,“IS_USERDEBUG”:false,“MANUFACTURER”:“asus”,“MODEL”:“ASUS_X00ID”,“PERMISSIONS_REVIEW_REQUIRED”:false,“PRODUCT”:“WW_Phone”,“RADIO”:“unknown”,“SERIAL”:“HBAXB7615040RNJ”,“START_TRACKER”:false,“SUPPORTED_32_BIT_ABIS”:[“armeabi-v7a”,“armeabi”],“SUPPORTED_64_BIT_ABIS”:[“arm64-v8a”],“SUPPORTED_ABIS”:[“arm64-v8a”,“armeabi-v7a”,“armeabi”],“TAGS”:“release-keys”,“TIME”:1563959888000,“TYPE”:“user”,“UNKNOWN”:“unknown”,“USER”:“jenkins”,“VERSION”:{“ACTIVE_CODENAMES”:,“BASE_OS”:“”,“CODENAME”:“REL”,“INCREMENTAL”:“15.2016.1907.519-0”,“PREVIEW_SDK_INT”:0,“RELEASE”:“8.1.0”,“RESOURCES_SDK_INT”:27,“SDK”:“27”,“SDK_INT”:27,“SECURITY_PATCH”:“2019-07-05”}},“TOTAL_MEM_SIZE”:25028554752,“AVAILABLE_MEM_SIZE”:19363155968,“BUILD_CONFIG”:{“APPLICATION_ID”:“org.acra”,“BUILD_TYPE”:“release”,“DEBUG”:false,“FLAVOR”:“”,“VERSION_CODE”:-1,“VERSION_NAME”:“5.4.0”},“CUSTOM_DATA”:{},“IS_SILENT”:false,“STACK_TRACE”:“java.lang.NullPointerException: FileDescriptor must not be null\n\tat android.os.ParcelFileDescriptor.(ParcelFileDescriptor.java:187)\n\tat android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:1045)\n\tat android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:1037)\n\tat android.bluetooth.IBluetooth$Stub$Proxy.connectSocket(IBluetooth.java:1996)\n\tat android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:363)\n\tat io.palaima.smoothbluetooth.BluetoothService$ConnectThread.run(BluetoothService.java:2)\n”,“INITIAL_CONFIGURATION”:{“FlipFont”:0,“appBounds”:“Rect(0, 0 - 720, 1280)”,“assetsSeq”:0,“colorMode”:5,“compatScreenHeightDp”:547,“compatScreenWidthDp”:320,“compatSmallestScreenWidthDp”:320,“densityDpi”:320,“fontScale”:0.85,“hardKeyboardHidden”:2,“keyboard”:“KEYBOARD_NOKEYS”,“keyboardHidden”:1,“locale”:“tr_TR”,“mcc”:286,“mnc”:1,“navigation”:1,“navigationHidden”:2,“orientation”:1,“screenHeightDp”:616,“screenLayout”:“SCREENLAYOUT_SIZE_NORMAL+SCREENLAYOUT_LONG_YES+SCREENLAYOUT_LAYOUTDIR_LTR+SCREENLAYOUT_ROUND_NO”,“screenWidthDp”:360,“seq”:10,“smallestScreenWidthDp”:360,“touchscreen”:“TOUCHSCREEN_FINGER”,“uiMode”:“UI_MODE_TYPE_NORMAL+UI_MODE_NIGHT_NO”,“userSetLocale”:false},“CRASH_CONFIGURATION”:{“FlipFont”:0,“appBounds”:“Rect(0, 0 - 720, 1280)”,“assetsSeq”:0,“colorMode”:5,“compatScreenHeightDp”:547,“compatScreenWidthDp”:320,“compatSmallestScreenWidthDp”:320,“densityDpi”:320,“fontScale”:0.85,“hardKeyboardHidden”:2,“keyboard”:“KEYBOARD_NOKEYS”,“keyboardHidden”:1,“locale”:“tr_TR”,“mcc”:286,“mnc”:1,“navigation”:1,“navigationHidden”:2,“orientation”:1,“screenHeightDp”:616,“screenLayout”:“SCREENLAYOUT_SIZE_NORMAL+SCREENLAYOUT_LONG_YES+SCREENLAYOUT_LAYOUTDIR_LTR+SCREENLAYOUT_ROUND_NO”,“screenWidthDp”:360,“seq”:10,“smallestScreenWidthDp”:360,“touchscreen”:“TOUCHSCREEN_FINGER”,“uiMode”:“UI_MODE_TYPE_NORMAL+UI_MODE_NIGHT_NO”,“userSetLocale”:false},“DISPLAY”:{“0”:{“currentSizeRange”:{“smallest”:[720,672],“largest”:[1280,1232]},“flags”:“FLAG_SUPPORTS_PROTECTED_BUFFERS+FLAG_SECURE”,“metrics”:{“density”:2,“densityDpi”:320,“scaledDensity”:“x2.0”,“widthPixels”:720,“heightPixels”:1280,“xdpi”:268.9410095214844,“ydpi”:268.6940002441406},“realMetrics”:{“density”:2,“densityDpi”:320,“scaledDensity”:“x2.0”,“widthPixels”:720,“heightPixels”:1280,“xdpi”:268.9410095214844,“ydpi”:268.6940002441406},“name”:“Yerleşik Ekran”,“realSize”:[720,1280],“rectSize”:[0,0,720,1280],“size”:[720,1280],“rotation”:“ROTATION_0”,“isValid”:true,“orientation”:0,“refreshRate”:60.000003814697266,“height”:1280,“width”:720,“pixelFormat”:1}},“USER_COMMENT”:null,“USER_EMAIL”:“N/A”,“USER_APP_START_DATE”:“2021-04-30T09:02:25.084+03:00”,“USER_CRASH_DATE”:“2021-04-30T13:54:58.232+03:00”,“DUMPSYS_MEMINFO”:“N/A”,“LOGCAT”:“N/A”,“INSTALLATION_ID”:“c542afaf-73c1-4a4a-96d8-e513bacfd55c”,“DEVICE_FEATURES”:{“android.hardware.sensor.proximity”:true,“asus.software.zenui.zentv”:true,“asus.hardware.touchgesture.swipe_up”:true,“asus.hardware.touchgesture.double_tap”:true,“android.hardware.sensor.accelerometer”:true,“asus.software.lockscreen.cmweather”:true,“android.hardware.faketouch”:true,“android.hardware.usb.accessory”:true,“android.hardware.telephony.cdma”:true,“android.software.backup”:true,“asus.software.onehand”:true,“android.hardware.touchscreen”:true,“android.hardware.touchscreen.multitouch”:true,“asus.software.theme.animated_theme”:true,“android.software.print”:true,“asus.software.sku.WW”:true,“android.software.activities_on_secondary_displays”:true,“android.software.voice_recognizers”:true,“android.software.picture_in_picture”:true,“android.hardware.fingerprint”:true,“android.hardware.sensor.gyroscope”:true,“asus.software.themes_store”:true,“android.hardware.opengles.aep”:true,“android.hardware.bluetooth”:true,“android.hardware.camera.autofocus”:true,“android.hardware.telephony.gsm”:true,“android.software.sip.voip”:true,“asus.software.preload”:true,“asus.software.presafe”:true,“android.hardware.usb.host”:true,“asus.software.twinapps”:true,“android.hardware.audio.output”:true,“android.software.verified_boot”:true,“android.hardware.camera.flash”:true,“android.hardware.camera.front”:true,“android.hardware.screen.portrait”:true,“asus.software.gamewidget.zenui45”:true,“android.hardware.sensor.stepdetector”:true,“android.software.home_screen”:true,“asus.software.sensor_service”:true,“android.hardware.microphone”:true,“asus.hardware.display.bluelight.reading_mode”:true,“asus.hardware.display.bluelight”:true,“android.software.autofill”:true,“android.hardware.bluetooth_le”:true,“android.hardware.sensor.compass”:true,“android.hardware.touchscreen.multitouch.jazzhand”:true,“android.software.app_widgets”:true,“android.software.input_methods”:true,“android.hardware.sensor.light”:true,“android.hardware.vulkan.version”:true,“android.software.companion_device_setup”:true,“asus.hardware.display.splendid”:true,“android.software.device_admin”:true,“android.hardware.camera”:true,“asus.software.whole_system_onehand”:true,“android.hardware.screen.landscape”:true,“android.hardware.ram.normal”:true,“android.software.managed_users”:true,“android.software.webview”:true,“android.hardware.sensor.stepcounter”:true,“asus.software.zenui”:true,“asus.software.sensor_service.terminal”:true,“android.hardware.camera.any”:true,“android.hardware.vulkan.compute”:true,“android.software.connectionservice”:true,“android.hardware.touchscreen.multitouch.distinct”:true,“android.hardware.location.network”:true,“android.software.cts”:true,“android.software.sip”:true,“asus.software.sensor_service.eartouch”:true,“android.hardware.wifi.direct”:true,“android.software.live_wallpaper”:true,“asus.software.theme.living_theme”:true,“asus.software.zenui.five”:true,“android.hardware.location.gps”:true,“asus.software.pagemarker”:true,“android.software.midi”:true,“asus.software.marketapp”:true,“asus.software.project.ZC554KL”:true,“android.hardware.wifi”:true,“android.hardware.location”:true,“android.hardware.vulkan.level”:true,“asus.hardware.display.splendid.reading_mode”:true,“android.hardware.telephony”:true,“asus.hardware.touchgesture.launch_app”:true,“glEsVersion”:“3.2”},“ENVIRONMENT”:{“getDataDirectory”:“/data”,“getDataMiscCeDirectory”:“/data/misc_ce”,“getDataMiscDirectory”:“/data/misc”,“getDataPreloadsAppsDirectory”:“/data/preloads/apps”,“getDataPreloadsDemoDirectory”:“/data/preloads/demo”,“getDataPreloadsDirectory”:“/data/preloads”,“getDataPreloadsFileCacheDirectory”:“/data/preloads/file_cache”,“getDataPreloadsMediaDirectory”:“/data/preloads/media”,“getDataSystemCeDirectory”:“/data/system_ce”,“getDataSystemDeDirectory”:“/data/system_de”,“getDataSystemDirectory”:“/data/system”,“getDownloadCacheDirectory”:“/data/cache”,“getExpandDirectory”:“/mnt/expand”,“getExternalStorageDirectory”:“/storage/emulated/0”,“getExternalStorageState”:“mounted”,“getLegacyExternalStorageDirectory”:“/sdcard”,“getLegacyExternalStorageObbDirectory”:“/sdcard/Android/obb”,“getOdmDirectory”:“/odm”,“getOemDirectory”:“/oem”,“getRootDirectory”:“/system”,“getStorageDirectory”:“/storage”,“getVendorDirectory”:“/vendor”,“isExternalStorageEmulated”:true,“isExternalStorageRemovable”:false},“SHARED_PREFERENCES”:{“default”:{“acra.legacyAlreadyConvertedTo4.8.0”:true,“acra.legacyAlreadyConvertedToJson”:true,“acra.lastVersionNr”:1}}}

It is a log file and I want to create database and put the file into the database.But I encounter with error

I have the same problem im trying to import a json file with this format

{“user_id”:“q-kq52Hm8a5ajWJ_dUlOoA”,“name”:“Minji”,“review_count”:2,“yelping_since”:“2010-07-16 15:37:15”,“useful”:8,“funny”:1,“cool”:2,“elite”:"",“friends”:“3iYVBhusw8WzL-fpHfzSJg, AHYWPHP0A_liXRQ1vwOTOQ, DnNCUxnLZJLKchU7ghBHEA, aOaBLef9O9WEYOOu_Ag0jg, byLkv1cyexwDrEEucXRl6A, W0VtBrATFgbrh5-dlT9enA, S5sN_XnLI7JLd07a03xf1w, sxO4cKLCHgPWDwLkTFm_xA, 5A_mUZytIYM0325LK52ghg, BLoIigmmcL–C89jCt75aA, AnZEey8ewxg2bOJwHwIpdQ, wDEhZdJRvC3RCE9unKKPgA, qtI1d1FEsyXPLF4ZeAs5Zg, gJPLWZ02gps2Z-aDtrg5pA, OZ2-ketYLpnad_HFnKwZ4g, q90aHWhAArWMNDIPMx3nww, jcQhpVQFpj8os1DPGkbQ3A, 9m3zKiIVD_oRWErUm8W92A, 2AQjYOwmO1VMv0pxMFgmFQ, hJZdG_TBMzpkSNAQzKP2pQ, nETnIaD_oxfdm7BCpWPQjg, lvIgUIjKTGDTVhHJt3uAfw”,“fans”:0,“average_stars”:1.0,“compliment_hot”:0,“compliment_more”:0,“compliment_profile”:0,“compliment_cute”:0,“compliment_list”:0,“compliment_note”:0,“compliment_plain”:0,“compliment_cool”:0,“compliment_funny”:0,“compliment_writer”:0,“compliment_photos”:0}

I did import a lot of files exactly like this but for some reason in this one im getting this:

Failed to import with the following error:

0 / ~1535625.9217676679

  • Cannot read property ‘_id’ of undefined

Do you fix that? I’m also facing the same problem