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.
Related
how can i perfom full data migration from ElasticSearch 5.6.16 to 7.2.0. I have an application running version 5.6.16. No i have to update some of the data to version 7.2.0. The manufacturer has written / provided an own tool for the migration, but this requires that the new installation (7.2.0) has been installed on a new separate server. But this is the only the last option for me. So what's an easy and good way to do this on the same machine? Or would it be an solution to install the new version (7.2.0) on the same machine with different port and then do my stuff as this would be two servers?
First backup the data and the re-import after installing new version? Did i get problems with the indexes (i read something about this.. that this could result in errors)
You have few questions but I will try to answer two important ones,
How can you run the two different version of elasticsearch on a single machine
Answer : it is possible although not recommended in production environment, as you guess it right, by running these two version on different ports.
How to migrate from ES 5.6 to 7.2
Answer: Elasticsearch provides the backward compatibility till last major version, so if you are upgrading to 7.X, than ES 6.X indices can be backed up and re-imported in ES 7.X but you can't do this for 5.X indices.
Note: Refer upgrade elasticsearch official doc for detailed explanation and process.
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
I would need to create a dpkg out of Play 2.0 Java project. It would run stand-alone with MongoDB (or some RDBS). It should be able to shutdown older version and ensure new version starts up cleanly.
Any advice how to create such? Any Play 2.0 related issues to take into account?
Edit: Looks like I will be using fpm
All these package manager installs basically run scritps. So first I would write bash scripts for uninstall, upgrade and install. You have to consider what parts can be replaced in the reinstall and how apply migrations on the database, file copy, and start stop of services. This is the hard part compared to creating a bundle. Only thing to consider for play! is stopping and starting the server when something needs to be replaced.
This might inspire you for startup shutdown scritps: https://gist.github.com/THemming/2173037
Is it possible to install a Sitecore package (containing content tree changes only) from a command line via batch/power shell instead of going into Sitecore UI?
I am looking for the best way to automate our build deployments.
Thanks.
You can do this with Power Shell. Great source of information on how to use Power Shell with Sitecore can be found on Adam Najmanowicz blog ( http://blog.najmanowicz.com/category/software-development/powershell/ ).
And some information about exporting and importing packages is in his post http://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/
There is also an experimental powershell install script avaliable at the Sitecore GitHub that also might be useful if you are doing full build deployments from scratch .. https://github.com/Sitecore/PowerShell-Script-Library
(Please feel free to fork and feedback any improvements !)
Sorry if this is overly simplistic.
I've decided that I want to use an SQLite database instead of a MySQL database. I'm trying to wrap my head around how simple SQLite is and would like a simple, one answer tutorial on how to use SQLite with the Zend Framework, where to put my SQLite database in my directory structure, how to create the database, etc.
#tuinstoel is correct, attaching to an SQLite database implicitly creates it if it does not exist.
SQLite also supports a command-line client that is more or less like MySQL's command shell, allowing you to issue ad hoc commands or run SQL scripts. See documentation here: http://www.sqlite.org/sqlite.html
Of course you need to change the Zend_Db adapter in your ZF application. ZF supports only an adapter to the PDO SQLite extension. SQLite doesn't support user/password credentials. Also since SQLite is an embedded database instead of client/server, the "host" parameter is meaningless.
$db = Zend_Db::factory("pdo_sqlite", array("dbname"=>"/path/to/mydatabase.db"));
One more caveat: when you get query results in associative-array format, some versions of SQLite insist on using "tablename.columnname" as the keys in the array, whereas other brands of database return keys as simply "columnname". There's an outstanding bug in ZF about this, to try to compensate and make SQLite behave consistently with the other adapters, but the bug is unresolved.
If you make a connection to a not existing database, a database is created on the fly. (You can turn this behavour off)
This is now covered in the Zend Framework quickstart tutorial (version 1.9.5 as of this writing). Just make a new project (with zf command line tool. look here for a great tutorial on setting it up), add these lines to your config.ini file and you're good to go:
; application/configs/application.ini
[production]
resources.db.adapter = "PDO_SQLITE"
resources.db.params.dbname = APPLICATION_PATH "/../data/db/databaseName.db"
Now when you ask for your default database adapter, it will use this one. I would also recommend downloading the quickstart tutorial source code and making use of the load.sqlite.php script. You can create a schema and data file and load the database with these tables/columns/values. It's very helpful! Just check out the tutorial. It's all in there.
This answer was moved out of the question into a CW answer to disavow ownership over the content.