CodeExplorer defaultCollection example
$option =
isset($matches['options'
]) ? '?'.
$matches['options'
] : '';
$connectionString =
$protocol.'://'.
implode(',',
$newServers).
$option;
$clusterOptions =
new ClusterOptions();
$clusterOptions->
credentials($username,
$password);
$client =
new Cluster($connectionString,
$clusterOptions);
$bucket =
$client->
bucket($matches['bucketName'
]);
$collection =
$bucket->
defaultCollection();
if (!
empty($matches['scopeName'
])) { $scope =
$bucket->
scope($matches['scopeName'
]);
$collection =
$scope->
collection($matches['collectionName'
]);
} return $collection;
} finally { restore_error_handler();
} }