Checking Whether a Given Collection Exists with SODA for In-Database JavaScript
You can use SodaDatabase.openCollection()
to check for the
existence of a given collection. It returns null
if the collection argument
does not name an existing collection; otherwise, it opens the collection having that
name.
In Example 8-2, if collectionName
does not name an existing collection then
col
is assigned the value null
.
Parent topic: Using SODA for In-Database JavaScript