Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to check if a remote database exists?

Tags:

pouchdb

Is there a pouchdb API to check if a remote database exists?

There is a db.info() method, but that requires a db object and using the following to create a db object will also create the target if it doesn't already exist:

var db = new PouchDB(url);

like image 868
Chris Snow Avatar asked Feb 13 '15 17:02

Chris Snow


People also ask

How to check if a MySQL database exists or not?

The schema_name command is used to check if a MySQL database exists or not. The syntax of this command is as follows − Now, the above command is used to check whether the database exists or not.

How do I check if a file exists in a collection?

Oh, right: as we noted, our query returns a collection of all the files with the Name C:\Scripts\Test.vbs. To determine whether or not the file exists all we have to do is check the Count of the collection; as the name implies, the Count tells you the number of items in the collection.

How to check how many databases are present in MySQL?

Note: We can check how many databases are present in MySQL with the help of the show command. Now, we can choose the name of a particular database with the help of the use command. The query is given as follows − We can also check the number of tables that are present in a particular database.

How to check remote port status in Linux?

Checking remote port status is a common task for Linux admin. Now we collect 5 different ways for this task. We don't need to install any package if we use the following two python commands. We need install the package if we choose nc, nmap,telnet. Use nc command nc -zvw10 192.168.0.1 22 Use nmap command nmap 192.168.0.1 -p 22


1 Answers

Yup, just use the skip_setup option:

var db = new PouchDB('http://localhost:5984/i_dont_exist', {skip_setup: true});
db.info()
  .then(console.log.bind(console))
  .catch(console.log.bind(console));

This will throw an error:

{ 
  status: 404,
  name: 'not_found',
  message: 'missing',
  error: true,
  reason: 'no_db_file'
}
like image 76
nlawson Avatar answered Jan 01 '23 13:01

nlawson