Commands: How to switch command to a different database?
By default, commands available directly in store are working on a default database that was setup for that store. To switch commands to a different database that is available on that server use ForDatabase method.
public IDatabaseCommands forDatabase(String database);
|database||String||name of a database for which you want to get new commands|
|IDatabaseCommands||New instance of commands that is scoped to the requested database.|
IDatabaseCommands commands = store.getDatabaseCommands().forDatabase("otherDatabase");
public IDatabaseCommands forSystemDatabase();
|IDatabaseCommands||Method returns new instance of commands that is scoped to the system database.|
IDatabaseCommands systemCommands = store.getDatabaseCommands().forSystemDatabase();