Unable to change chunkSize in MongoDB

I have deployed a MongoDB which is the database of my Parse server. But I’m not able to upload files more than 700 kilobytes to parse server, with parseFile.saveFileInBackground() function in parse-android-SDK. The exception thrown by callback is I/O Failure , and the cause is timeout. I considered too many issues, and I figured out maybe changing the default chunk size that files are divided into them in MongoDB, works something out. I used db.settings.save( { _id:"chunkSize", value: <size-in-magabyte> } ) in MongoDB shell. But I can not really feel any changes. After this command chunkSize field of entries stored under files.fs class in MongoDB, is still the same as before, 261120. What I actually want to do is change this 261120 to 358400. I want my files to be divided into chunks of size 358400 byte and not 261120. Any helps would be appreciated.

Do you have any reverse proxy on top of parse server? They use to have a max payload limit and that’s the most common reason why “big” files do not upload.

I will check it out and will be back again as soon as possible

Things are getting stranger… A React native developer can upload files up to 3 MB and even larger. He uses base64 encoding and now I’m looking for android equivalent. I asked it in another thread here in parse community.

That’s strange because when you encode file to base64, file size increases by 25%. You should be able to upload normal file when you can upload base64.

Do you use any proxy or load balancer like Nginx? Is there any chance that you are using that proxy but your friend uses direct parse server url?

If you are using nginx you have to increase max payload size.
Here is the steps:
1- Login to your server via SSH.
2- sudo nano /etc/nginx/nginx.conf
3- paste this to between http brackets: client_max_body_size 10M;
10M means limit is 10Megabyte. Set limit according to your needs.
4- save config file
5-restart nginx server: sudo systemctl restart nginx

Thank you, and also another question. I believe that there is a mistake in my deployment. I have MongoDB service running on my server and I have gaven it a 10GB dedicated volume. But I haven’t given my parse server service any volume. Should I do?

I mean if you write files to disk in cloud code, yes you should. Apart from that, Parse server also keeps logs on disk. And if you use internal cache, cache also need disk space. But I’m not quite sure. Your best bet is asking this to parse developers. I’m not expert on this.

Thank you very much. So I’ll start another thread to get in details about it.

Well, after many failures I attempted to try your solution, but I can not login via SSH, Permission denied after entering password. Since I’m using a hosting service, it seems that I can not access files of server. What should I do now? (It is a Linux server)

if you don’t have root access, you should talk to your service provider. But if you don’t have root, you can’t install nginx either. So i assume your problem is not proxy

Hey I’m back again. I figured out that uploading larger files can be done with a fast network like 4G cellular data by android client. Does it give you any ideas about the issue?

Parse android SDK tries again when server doesn’t respond in a specific time. That could be issue. Try uploading file with rest API. İf file upload is successful, you can disable try again feature of android sdk

How could disabling retry help? I mean what is the effect?