Importing a `bson` dataset with montorestore - database

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.

Related

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.

Error import data to mongo atlas cluster mongimport

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

issues making default collection for solr

I am trying to install solr so that my data catalog could use it. To do so, I used these steps which are mentioned on the documentation of my data portal:
cd solr/solr-config
wget http://apache.crihan.fr/dist/lucene/solr/6.0.0/solr-6.0.0.tgz
tar xvfz solr-6.0.0.tgz
solr-6.0.0/bin/solr start -c -p 8984
solr-6.0.0/bin/solr create -p 8984 -c catalog_srv -d src/main/solr-cores/catalog
accourding to these instructions I made a directory /opt/solr/solr-config the downloaded and unziped solr, and started it on port 8984. Now I don't understand how does the last command works. what should be the second path src/main/solr-cores/catalog? I thought I should generatet the directories src, main solr-cores and catalog inside my solr-config directory and then run this command. but I got errors that solrconfig.xml could not be found. after adding solrconfig.xml to /opt/solr/solr-config/src/main/solr-cores/catalog, now I get an error:
ERROR: Failed to create collection 'catalog_srv' due to: {127.0.1.1:8984_solr=org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://127.0.1.1:8984/solr: Error CREATEing SolrCore 'catalog_srv_shard1_replica1': Unable to create core [catalog_srv_shard1_replica1] Caused by: Can't find resource 'schema.xml' in classpath or '/configs/catalog_srv', cwd=/opt/solr/solr-config/solr-6.6.0/server}
what is schema.xml? is it something about data of my data portal? could you please explain the issue and how should I determine the path src/main/solr-cores/catalog to avoid these errors? what does exactly a default collection of solr do?
More info: my data portal is an opensource software called geonetwork and the documentation about solr is here: http://geonetwork-opensource.org/manuals/trunk/eng/users/maintainer-guide/installing/installing-solr.html?highlight=solr

Unable to download AppEngine datastore entities

Based on other questions, I expected to be able to run the following command to get a dump of datastore entities for my app:
appcfg.py download_data --filename data.db .
(Here's the app.yaml file in that directory.)
When I run that command, however, I get a long stack trace ending with a crypic error:
google.appengine.api.datastore_errors.BadRequestError: app s~old-nyc cannot access app old-nyc's data
I get this error even if I explicitly specify --application=old-nyc. If, as suggested in this question, I specify --application=s~old-nyc, then I get this error:
[ERROR ] Authentication Failed: Incorrect credentials or unsupported authentication type (e.g. OpenId).
What do I need to do to download my data?
Specifying --application s~old-nyc changed the default URL to http://s~old-nyc.appengine.com rather than http://old-nyc.appengine.com. To get the command to work, I also had to specify --url http://old-nyc.appspot.com/remote_api.
My full command was:
appcfg.py download_data --application s~old-nyc --url http://old-nyc.appspot.com/_ah/remote_api --filename data.db

DSpace error with oai import

After configuring my DSpace server, its working correctly but when I look at the OAI identify page (http://repositorio.puce.edu.ec/oai/request?verb=Identify) so we can be harvested, it says that the repository is localhost instead of my URL. I investigated and found out that to update this, I have to run this command: dspace/bin/dspace oai import -c but when I run that command is gives me the following error: Solr server (http://repositorio.puce.edu.ec/solr/oai) is down, turn it on.
I can see the Solr Admin (it can't be seen from the outside because of security reasons) so I don't know what should be turned on or how to do it?
Thanks for the help.
I encountered this error in the past.
Looking at my oai.cfg file, I used localhost for some settings and my public URL for others.
solr.url=http://localhost/solr/oai
# OAI persistent identifier prefix.
# Format - oai:PREFIX:HANDLE
identifier.prefix = repository.library.georgetown.edu
# Base url for bitstreams
bitstream.baseUrl = https://repository.library.georgetown.edu
If you need to make a config change, be sure to clear the cache after restarting service.

Resources