Start a new topic

Nonexistent Collection Response

If you attempt to query a collection that doesn't exist (and never has) should there be some kind of indication returned? We realized today that attempting to fetch from any collection name simply returns 200 with empty result array. Is this the desired functionality? Could be wrong, but we thought in the past it would return an error (which is then caught using the error definitions, for example in JS SDK).



This was discovered because we are using collection names appended with language codes for multilingual support, so the collection name is determined programmatically. We hoped that we could catch an error/message if a specific translated collection does not exist, and if so, default to the standard (english) collection.



Note: Putting this question in REST API, as it seems to apply to other SDKs and was tested/confirmed against REST API in console.

That is correct -- querying a collection that does not exist has the same result as querying an empty collection. This behavior is due to our underlying database.



If you would like to check whether a collection exists, you can do so using the collectionAccess module's collectionExists method in BL.

Can you provide some sample of the usage of CollectionExists function?

What is a "current" collection your manual talking about?

How can I provide the collection name for the check and what is a signature of the callback that the function accepts as a parameter?

Thanks ahead!

Login or Signup to post a comment