Parse server - File not found - mongodb

Parse server version: 2.8.4
Parse dashboard version: 1.2.0
MongoDB version: 4.0.2
Hosting service: DigitalOcean
=================================
I'm transferring my app to a new Parse server and a new MongoDB server.
Everything works fine except the fact that I can't load any images! The content is being fetched properly, but the images don't load. Neither from the app, nor from the dashboard. (I get the File not found. there)
Here's how I transferred my db:
mongodump --host sourceIP -d dbName --port 27017
and then to load it:
mongorestore --db dbName dbDir --username “username” —password "password" --authenticationDatabase "admin"
I did a db.fs.files.find() and the images seem to be there just fine!
I also tried uploading a new image file and got the error:
error 130. Could not store file.
I believe that this is a db-side issue, because I tested the parse server with another MongoDB I have and it was working!
I also tried creating a new droplet and redo everything, but it didn't fix it!
Any suggestions?

I spent 2.5 days of my life, full of stress, just because I had the symbol & in my auth password, inside my databaseURI! For some reason, it doesn't affect fetching the data but it does affect fetching images!

Related

I am getting an empty directory after running mongodump

I want to do a backup of my MongoDB for a Meteor app on Ubuntu 14.04 on Digitalocean. So I ran the command
mongodump -d dbName -o ~/backups/first_backup
The log i see is this
connected to: 127.0.0.1
Tue Jun 14 09:10:58.240 DATABASE: dbName to /home/kenshinman/backups/first_backup/dbName
Then when I visit the path, I see a blank folder with the dbName.
Am I doing something worng?
But I also found out that the mongoexport command is working fine
I found a solution. Thanks to nearpoint for his solution. Since I uploaded my MeteorJs app with Mupx, MupX placed my mongodb in a container using Docker
So, I followed his steps and It worked fine.
Here's his solution

Getting empty folder when using mongodump to back up my MongoDB

Basically, I have a problem with using mongodump to back up my MongoDB.
This is the general syntax I use in SSH:
mongodump -d myDatabaseName -o ~/backups/my_backup
This is the resulting message:
Fri Apr 22 20:39:57.304 DATABASE: myDatabaseName to /root/backups/my_backup/myDatabaseName
This simply generates a blank folder with no files in it whatsoever. The actual database is fairly large, so not sure what's going on.
I would also like to add that my mongodump client and my MongoDB version are both the same (version 2.4.9).
Not sure how to go about fixing this. Any help is appreciated.
This is a similar question as Mongodump getting blank folders
There is no accepted answer as of writing my answer. Here is what I did to resolve my issue and I believe it will help you as well.
The default mongodb-client deb package with Ubuntu is the issue. I removed those and installed the mongodb-org-tools package from mongodb.com https://docs.mongodb.com/master/tutorial/install-mongodb-on-ubuntu/?_ga=2.36209632.1945690590.1499275806-1594815486.1499275806
They have other install instructions for your specific OS if you are not on Ubuntu https://www.mongodb.com/download-center?jmp=nav#community
Try adding the port of mongodb_port as in:
mongodump --port your_number -c the_collection -d the_database
Make sure that you have the exact name of the database. If you spell it wrong, this could happen. To confirm, connect to your mongo database and type show dbs to see a list of database names. Then make sure that your databasename parameter -d <databasename> matches one of those in the list.

MongoLab error - 'mongo not found'

I am hosting an app on heroku and I'm trying to connect it to the MongoDB database using the MongoLab addon. One of the steps is to type:
mongo ds044064-a0.mongolab.com:44064/heroku_w6fhwppg -u <dbuser> -p <dbpassword>
But I keep getting the error "mongo not found" Anyone have any ideas why? The add-on is installed.
Thanks!
mongo refers to the mongo shell binary, which you'll need to install locally. It, along with all the other MongoDB binaries, can be downloaded here:
https://www.mongodb.org/downloads

Mongorestore command not found with meteor

Ok guys I receive a bunch of files of a mongodb (.bson and .json) I want to replace my current meteor mongodb, I have read al this post about it:
meteor: how can I backup my mongo database
Mongorestore, from meteor production server to local
Restore a mongodb in meteor production server
MongoDB: mongorestore: command not found (this actually have nothing to do with my problem)
and I end writing in my terminal while meteor app was running
mongorestore -h 127.0.0.1:3001 --port 3001 -d meteor ~/Github/mongo/mongoDBRESTORE/admin/
but the problem its that terminal output is not command found
does anybody know what Im doing wrong, what its the right way to do this?
As #rgoomar pointed in the comments I need to download https://www.mongodb.org/downloads the mongodb bin files then I simple execute ~/mongodb/bin/mongorestore -h 127.0.0.1:3001 -db meteor ~/Github/mongo/mongoDBRESTORE/admin
and worked!

Deploy local mongo collection to meteor.com server

I am starting my first meteor app, using MongoDB for my database.
I have copied my data in from a JSON file into mongodb collection and when hosting locally, the data appears as expected; the collection is in the meteor mongo database and I can interpret at will
When I deploy the app to xx.meteor.com, the meteor collection I need (named 'assets') does not get posted to the mongodb on the server. I can check this by using meteor mongo onemore.meteor.com. Other collections are posted though.
How do I deploy my mongoDB colletion ('assets') along with the app using meteor deploy?
Is this issue due to the way the mongodatabase was orginally imported? I used this method: https://github.com/awatson1978/meteor-cookbook/blob/master/cookbook/database-management.md
I copied the collection ('assets) from a staging database using db.copyDatabase('staging3','meteor','localhost')
Using mongodump and mongorestore also works:
Dump data from existing mongodb (mongodb url: mongodb://USER:PASSWORD#DBHOST/DBNAME)
mongodump -h DBHOST -d DBNAME -u USER -p PASSWORD
This will create a "dump" directory, with all the data going to dump/DBNAME.
Get the mongodb url for the deployed meteor app (i.e. www.mymeteorapp.com)
meteor mongo --url METEOR_APP_URL
This will return the following:
mongodb://#USERNAME#:#PASSWORD###HOSTNAMEANDPORT#/#YOURAPPLICATION#
Note: the PASSWORD expires every min.
Upload the db dump data to the meteor app (using an example meteor db url)
mongorestore -u #USERNAME# -p #PASSWORD# -h #HOSTNAMEANDPORT# -d www_mymeteorapp_com dump/DBNAME/
All the data should get transferred!
This answer is basically a modified version of Davidd8's answer here, but because that was never accepted I reposted it here.
None of the above worked for me. Here is what did the trick for me:
1) How do I get my localhost dump of my meteor db?
tip 1: make sure mongo is running (type mongod to run it)
Which port was my meteor running on?
$ mongodump --host localhost:3002 (nope)
$ mongodump --host localhost:3000 (nope)
$ mongodump --host localhost:3001 (yes!) this worked
Now where the heck did it put my dump?
$ ls (shows me the dump is in my current directory and meteor is inside the dump directory)
I need to somehow get that meteor data onto my live site on meteor.com
Now the next problem is that meteor.com will give me the information I need but I only have 1 minute before their information expires.
This information is what I need to connect to my remote meteor site and import my local meteor data.
I type this in the terminal:
$ meteor mongo --url iamcool.meteor.com
Then it spits back something like this:
mongodb://client-11f3014w:f1c52f68-8506-b682-c880-b5db03a9510e#production-db-a2.meteor.io:27017/iamcool_meteor_com
I used info from above that told me what data to extract from the above code and where to put it in the mongorestore code
mongorestore -u #USERNAME# -p #PASSWORD# -h #HOSTNAMEANDPORT# -db www_mymeteorapp_com dump/DBNAME/
This is where you have to be a super fast typer. I recommend opening a blank file in your IDE (Sublime Text or Atom or whatever you use) and create this template:
mongorestore -u XXX -p XXX -h production-db-a2.meteor.io:27017 -db iamcool_meteor_com dump/meteor
So I took the data meteor.com gave me and I plugged it in below:
mongorestore -u client-4bf9be36 -p d1cdef86-6c71-3b11-ef4c-221fbdcf07d0 -h production-db-a2.meteor.io:27017 -db iamcool_meteor_com dump/meteor
And then the errors came. And boy did they come.
Sometimes I got this error:
too many positional arguments
Sometimes I got this error:
Failed: error connecting to db server: auth fails
But this error tip gave me the info that saved the day:
try 'mongorestore --help' for more information
I did and I found out that the flag to pass for database wasn't -db but rather -d
I made the following change and typed it fast using my trusty template (see above)
mongorestore -u client-4bf9be36 -p d1cdef86-6c71-3b11-ef4c-221fbdcf07d0 -h production-db-a2.meteor.io:27017 -d iamcool_meteor_com dump/meteor
And then it worked.
It took me two hours to figure out. Hope it saves you the time I lost.