HasCollection()
Checks whether a collection exists in the request’s database.
pub async fn has_collection(&self, request: HasCollectionRequest) -> Result<HasCollectionResponse>
Request Syntax
let request = HasCollectionRequest::builder()
.collection_name("books")
.build()?;
REQUEST FIELDS:
database_name: Option<String>Name of the target database; uses the default database when empty.
collection_name: StringName of the collection to check. Required.
RETURN TYPE:
Result
RETURNS:
A HasCollectionResponse indicating whether the collection exists. Returns an Error if the operation fails.
HasCollectionResponse
exists() // -> bool
METHODS:
exists()(bool) -Whether the collection exists.
Example
let request = HasCollectionRequest::builder()
.collection_name("books")
.build()?;
let resp = client.has_collection(request).await?;
println!("exists: {}", resp.exists());