Cloning MongoDB database with MongoDB Compass - database

Is there a way to Clone a MongoDB database and its data with MongoDB Compass to my local server? I do not want to corrupt the dev environment by accident so I want to test things out locally, but I can't find a solution for that on MongoDB Compass.

MongoDB Compass has a great documentation explaining how you can import/export one collection at the time for both JSON and CSV files.
I think that there is no better answer than the link to the documentation: https://docs.mongodb.com/compass/current/import-export#import-data-into-a-collection

Related

MongoDB copy database excluding some collections

How can I copy a database ignoring some collections (like --excludeCollection in mongodump)? I am currently using the copydb command and MongoDB 3.6. Please help!
MongoDB 4.2 has removed Support for the copydb and clone Commands:
Starting in version 4.2, MongoDB removes the deprecated copydb command and clone command.
The corresponding mongo shell helpers db.copyDatabase() and db.cloneDatabase() can only be run when connected to MongoDB 4.0 or earlier.
As an alternative, users can use mongodump and mongorestore or write a script using the drivers.
In light of this, it's best to not indulge on using this command anymore.
To answer your question, copydb does not provide a way to selectively copy parts of a database. You would need to use mongodump and mongorestore to achieve this.

Migrate standalone Solr to Solr Cloud by copying index directory to new empty collection

We have to migrate customers using Solr to Solr Cloud. I know that the cleanest way is to re-import data again, but it would last for a really long time.
We tried to create collection in Solr Cloud and then copy there standalone solr indexes. It works.
The question is, whether it is worthy to try this in production. What can go wrong?

How do I access a database with open source swift?

I have build an app in swift that downloads content from my ubuntu server. The content on my server is build with help of some php/javascript scripts and stored in a mysql database, before it is send to the app. However I can't actually test this content, until I download it on the app, which causes me to spend hours on hours testing all the input.
I could make my workflow flow 10x faster if I could test it on the server. Luckily Apple released open source swift half a year ago, so I figured I could just copy the relevant swift code from my app to the server.
However it doesn't seem there is any way to access my database with open source swift and neither is NSURLSession.sharedSession() implemented yet, so I have no idea how to access my database on my server.
My database is mysql, but I wouldn't mind changing it to sqlite or some other type of database, if that would help solve the problem.
So there is my question, how do I access a database with open source swift on ubuntu?
I found a package that gives me access to a mysql database from swift:
https://github.com/novi/mysql-swift
I found some other similar packages as well, but I didn't test any of those, so I don't know whether they are any good.

how to use mongoDB database for web application without installing mongoDB on machine?

I have got a task to send an application to client, that will have angular at client side with nodejs server. I need to use the database, and mongoDB is the only one which i know to use. I have built various web application with mongoDB database to store the information. surely i have installed it on windows machine. My question is, how can i use the mongoDB without installing on the machine, considering that the client will not have to go through unnecessary steps like installing mongoDB on machine and then see my demo. All i want is he runs the node server and see the demp app.
is there any mongoDB service which i can use? how to connect with node server?
please help
You could try modulus, I made a simple project using their mongoDB host and it was pretty easy to implement.
Download the MongoDB for Windows binaries as zip file: open https://www.mongodb.com/try/download/community, select the version you need, Platform: Windows and Package: zip
Extract it anywhere you like, for example to C:\mongo
Create the data directory (e.g. C:\mongo\data)
Run C:\mongo\bin\mongod.exe --dbpath=C:\mongo\data
To stop the MongoDB, you may just use Control-C

Solr - Migrate Documents from one Collection to another existing one

I need to move all Solr Documents from one collection to another (already existing collection) - there are 500,000 documents.
I have tried the solr migrate but cannot get the routing key correct. I have tried:
curl 'http://localhost:8983/solr/admin/collections?action=MIGRATE&collection=oldCollection&target.collection=newCollection&split.key=!'
I have solr 4.10.3 installed in a cloudera installation.
Copy your existing oldCollection, and rename the as newCollection,
After that you may need to update some config files for the same.
Or create a new one using the below api
https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-api1
The answer and the question are quite old, starting from 8.1 solr version, there is a feature specific for this purpose which is the reindexcollection api which can directly be used to reindex docs from source to a target collection with a lot of configurable options. Here is the link to the official doc : https://lucene.apache.org/solr/guide/8_1/collections-api.html#reindexcollection

Resources