Wednesday, February 5, 2020

Mongodb - Import JS file

Importing database file in mongdb can be a headache if you haven't done it before. The most common way of exporting and importing database using commands mongodump and mongorestore. But what if you have js file to import.
Here is the way to import js file in mongo database.

Solution :

mongo 127.0.0.1/dbname exportedjsfilename.js

Mongo DB Error

MongoDB Exception – yii\mongodb\Exception
127.0.0.1:27017: The 'cursor' option is required, except for aggregate with the explain argument


Solution :

Check the version of mongo db. I got this error while importing a database into mongodb 4.0 and database was exported from older version of mongo db 2.6 or 3.2.

I installed mongodb 2.6 in docker and imported the database. Now application was connected from docker mongodb.

It fixed the issue.

Magento Error

main.CRITICAL: Class Magento\Framework\App\Http\Interceptor does not exist {"exception":"[object] (ReflectionException(code: -1): Class Magento\\Framework\\App\\Http\\Interceptor does not exist

Solution :
You need to run commands  one by one and check if it fixes the issue.
bin/magento cache:clean
bin/magento cache:flush
bin/magento setup:di:compile

Note : Take backup of code and database before running these commands.