Retrieves a list of all data collections associated with the site or project.
By default, the list is ordered by ID in ascending order.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function listDataCollections(
options: ListDataCollectionsOptions,
): Promise<ListDataCollectionsResponse>;
Options for retrieving a list of data collections.
import { collections } from "wix-data.v2";
export async function myListDataCollectionsFunction(options) {
try {
const myDataCollections = await collections.listDataCollections();
return myDataCollections;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Returns a promise that resolves to a list of existing data collections:
* {
* "collections": [
* // ...
* {
* "_id": "myMusicCollection",
* "collectionType": "NATIVE",
* "displayName": "My Music Collection",
* "displayField": "myMusicCollection",
* "capabilities": {
* "dataOperations": [
* "IS_REFERENCED",
* "INSERT",
* "SAVE",
* "BULK_INSERT",
* "BULK_UPDATE",
* "UPDATE",
* "TRUNCATE",
* "REMOVE",
* "REMOVE_REFERENCE",
* "COUNT",
* "FIND",
* "REPLACE_REFERENCES",
* "BULK_REMOVE",
* "INSERT_REFERENCE",
* "GET",
* "BULK_SAVE",
* "QUERY_REFERENCED",
* "DISTINCT",
* "AGGREGATE"
* ],
* "collectionOperations": [
* "UPDATE",
* "REMOVE"
* ],
* "indexLimits": {
* "regular": 3,
* "unique": 1,
* "total": 4
* }
* },
* "fields":
* [
* {
* "key": "artist",
* "displayName": "Artist Name",
* "type": "TEXT",
* "systemField": false,
* "capabilities": {
* "sortable": true,
* "queryOperators": [
* "EQ",
* "LT",
* "GT",
* "NE",
* "LTE",
* "GTE",
* "STARTS_WITH",
* "ENDS_WITH",
* "CONTAINS",
* "HAS_SOME",
* "HAS_ALL",
* "EXISTS",
* "URLIZED"
* ]
* },
* "encrypted": false,
* "description": "The artist's name"
* },
* {
* "key": "_id",
* "displayName": "ID",
* "type": "TEXT",
* "systemField": true,
* "capabilities": {
* "sortable": true,
* "queryOperators": [
* "EQ",
* "LT",
* "GT",
* "NE",
* "LTE",
* "GTE",
* "STARTS_WITH",
* "ENDS_WITH",
* "CONTAINS",
* "HAS_SOME",
* "HAS_ALL",
* "EXISTS",
* "URLIZED"
* ]
* },
* "encrypted": false
* },
* // Additional system fields ...
* ],
* "permissions": {
* "insert": "SITE_MEMBER_AUTHOR",
* "update": "SITE_MEMBER_AUTHOR",
* "remove": "SITE_MEMBER_AUTHOR",
* "read": "ANYONE"
* },
* "revision": "1",
* "plugins": [],
* "pagingModes": [
* "OFFSET"
* ],
* "_createdDate": "2023-07-19T12:40:02.372Z",
* "_updatedDate": "2023-07-19T12:40:02.372Z"
* }
* ],
* "pagingMetadata": {
* "count": 18,
* "offset": 0,
* "total": 18,
* "tooManyToCount": false
* }
* };
* */
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.