Error import data to mongo atlas cluster mongimport - database

I' trying since 2 days to import data to my mongo cluster using the mongimport command but i'm getting an error
my mongoimport command
mongoimport --uri mongodb+srv://cabinetdermes:<MYPASSWORDHERE>#cluster2.ufzkq.mongodb.net/cabinetdermes --collection myData --type json --file /Users/zakisb/Desktop/inventory.crud.json
The error that i keep getting
2021-10-08T13:33:35.808+0100 error parsing command line options: error parsing uri: lookup cluster2.ufzkq.mongodb.net on 172.20.10.1:53: cannot unmarshal DNS message
it's strange because i've already done the import before with another db and it worked successfully. yet this time i' getting error. Please help !

I solved the problem by simply go to settings and changing my dns adresse.

Use with option --gzip
check this

Related

Importing a `bson` dataset with montorestore

I have created a database, Restuarants through Atlas and made an empty collection, restuarants.
I connected to my Atlas account with mongosh and attempted to import a .bson file with restore using the following command:
mongorestore -d Restaurants -c restaurants /Users/username/restaurants.sampleRestaurants.bson
However, I get the following error:
Uncaught:
TypeError: Cannot assign to read only property 'message' of object 'SyntaxError: unknown: Missing semicolon. (1:15)
I can't tell what's wrong. Been looking through the docs but can't really find an answer.

SyntaxError: Missing semicolon when trying to export Mongo Atlas collection to local machine

I am having a problem exporting a collection from Mongo Atlas to my local machine. I have tried several different formats including this one, which I found in the official Atlas documentation on importing and exporting data.
First I log into my Atlas like so:
mongosh "mongodb+srv://cluster0.oyvrw.mongodb.net/dbname" --username uname
Then I try the command from the official docs:
mongoexport --uri mongodb+srv://uname:password#cluster0.oyvrw.mongodb.net/dbname --collection colname --type json --out cats.json
I have looked around at other similar questions and tried everything I can find online without success. One suggestion was not to run the command from the mongo shell but from the regular command line, but this does not work either.
It seems like it should be easier to get a collection out of Atlas to JSON. Any help or suggestions are much appreciated. Thanks!
For anyone facing this error, the mongoexport command does not work with mongosh. It must be run with the system shell.
However, mongoexport is part of mongo-database-tools, which as of MongoDB 4.4, is released separately. As a result, running mongoexport in the system shell will throw a command not found if the installed version of MongoDB is 4.4 or greater.
To solve this you can install the database tools using homebrew:
brew install mongodb/brew/mongodb-database-tools
Of course, make sure you have homebrew already installed. If not a quick Google will help.
Then following command should work to perform an export:
mongoexport --uri mongodb+srv://<username>:<password>#cluster0.oyvrw.mongodb.net/<dbName> --collection <collectionName> --type json --out /Users/macuser/desktop/exportBU.json
Hope that helps anyone having similar problems getting data in/out of MongoDB.

Airflow initdb command fails after linking with postgresql

I am trying to connect Airflow with a Postgresql DB.
When in airflow.cfg I change the sql_alchemy_conn = spostgresql+psycopg2://127.0.0.1:5432/airflow, where airflow is the name of my DB which is installed on the same machine.
After updating the config file, I run airflow initdb and get the following error which I cannot understand:
File "/some_path/env/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 232, in load
"Can't load plugin: %s:%s" % (self.group, name)
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:spostgresql.psycopg2
I found this on the web, which seems to "solve" this problem, but the solution was not clear to me at all.
Can someone tell me what the problem is and how to solve it?
Looks to me like you have a typo in your sqlalchemy connection string (s at the beginning of postgres). Try changing:
spostgresql+psycopg2://127.0.0.1:5432/airflow
to
postgresql+psycopg2://127.0.0.1:5432/airflow

How to share a MongoDB Database

I am working on a website with someone and I am trying to figure out if there is a way to push the db to github and have it work on his computer? We do not have a server yet and what is messing me up is that I need to specify a full log path and that means that it will not work on his computer.
Thanks
You can use mongoexport command to export your collection in .json format and then upload all .json file on github.
mongoexport --db test --collection collection_nam --out file_name.json
After that, you can import same .json file in MongoDB by using mongoimport command
https://docs.mongodb.com/manual/reference/program/mongoexport/
https://docs.mongodb.com/manual/reference/program/mongoimport/

Rank & Retrieve, Failed to connect to gateway.watsonplatform.net

I am trying to create a Create Solr cluster using java class as given in steps on below link as shown here
but i am getting following error, can this be firewall issue?
Using JAVA
com.ibm.watson.developer_cloud.service.WatsonService execute SEVERE: IOException java.net.ConnectException: Failed to connect to gateway.watsonplatform.net/:443 at com.squareup.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:139) at com.squareup.okhttp.internal.io.RealConnection.connect(RealConnection.java:108) at com.squareup.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184) at com.squareup.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126) at com.squareup.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95) at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281) at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224) at com.squareup.okhttp.Call.getResponse(Call.java:286) at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:243) at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:205) at com.squareup.okhttp.Call.execute(Call.java:80) at com.ibm.watson.developer_cloud.service.WatsonService.execute(WatsonService.java:122) at com.ibm.watson.developer_cloud.service.WatsonService.executeRequest(WatsonService.java:183) at com.ibm.watson.developer_cloud.retrieve_and_rank.v1.RetrieveAndRank.createSolrCluster(RetrieveAndRank.java:168) at Test.artf.CreateASolrClusterExample.main(CreateASolrClusterExample.java:20)
Using CURL
When i try using curl command as below that also gives connection error as below.
curl -X POST -u "":"" "https://gateway.watsonplatform.net/retrieve-and-rank/api/v1/solr_clusters" -d ""
Response:
curl: (7) couldn't connect to host
when i put the link in curl command in crome, it pop up for id/password. After giving id/password returns me
{"clusters":[]}
The service is experiencing some issues currently; the team is aware and working on it. Sorry for the trouble, please try again in a little while.

Resources