Start a new topic

Check if collection exists

Is there a way to check if a collection already exists?

A method for this was just added this week:


collectionAccess.collection("myCollection").collectionExists(function(err, result) {

if (err) {


} else {

response.body = result;





This will output



exists: true


Thanks Morgan. Since its from within BL I have access to modules.collectionAccess.collection("collectionName"). Is there a way to use this object to figure if the collection pre exists. I guess using count() would be one option but is there a better way via collectionAccess module?
Hi Pankaj!

We don't have direct support for this in our API. The next best thing you can do is to perform a GET on the collection and count the number of objects that are returned.

Edited: my previous answer was incorrect.
Login or Signup to post a comment