Operation passed in cannot be an Array

I’m trying to upload data into my db, my college says he can upload it fine, but when I do it fails.
The original data that is being uploaded has ‘failed’ in the name, and the modified version has ‘succeeded’ in it. When I try to upload ‘failed’ it gives me the ‘Operation passed in cannot be an Array’ error, but the ‘succeeded’ version looks like the same formatting to me, but it works.

The display of the data is also different. when data from ‘succeeded’ is imported it is in a document, the filenames are listed as sub categories, a text sub category exists below each filename and then finally below that you have the array of floats. I don’t want this additional text level.

How do I upload this data without getting this text layer.

see documents on my drive public share - Google Drive

Hi @Alexander_Sage and welcome in the MongoDB Community :muscle: !

I downloaded the 2 files and I imported them successfully in a MongoDB cluster with these commands:

$ mongoimport --drop -d test -c suc document_vectors_succeed.json 
2022-04-13T17:21:36.940+0200	connected to: mongodb://localhost/
2022-04-13T17:21:36.941+0200	dropping: test.suc
2022-04-13T17:21:36.973+0200	1 document(s) imported successfully. 0 document(s) failed to import.
$ mongoimport --drop -d test -c fail document_vectors_fail.json 
2022-04-13T17:21:43.981+0200	connected to: mongodb://localhost/
2022-04-13T17:21:43.981+0200	dropping: test.fail
2022-04-13T17:21:44.064+0200	1 document(s) imported successfully. 0 document(s) failed to import.

I end up with a different result than you:


Each of the arrays are fairly large in this last doc so I didn’t expend them.

So I don’t know what is your problem exactly but if I can give you an advice, it would be to rename the fields so it looks a bit cleaner and they don’t contain whitespaces.


thanks @MaBeuLux88
that helped. I was trying to upload it through the compas UI
when I uploaded the ‘failed’ file through pymongo, it worked fine
wish both methods worked the same, but I got a solution

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.