Appwrite icon

Appwrite

Interact with Appwrite API

Actions181

Attribute → Create Float

AI-generated

Overview

This node interacts with the Appwrite API to create a float attribute within a specified database and collection. It is useful for defining schema attributes that store floating-point numbers, with options to set constraints like minimum and maximum values, default values, and whether the attribute is required or an array. Practical applications include managing data schemas for applications that require precise numeric data storage, such as financial or scientific data.

Use Case Examples

  1. Creating a float attribute named 'price' in a product database collection, with a minimum value of 0 and a maximum value of 10000, to ensure valid pricing data.
  2. Defining a float attribute 'temperature' in a weather data collection, allowing an array of values to store multiple temperature readings.

Properties

Name Meaning
Database ID The ID of the database where the attribute will be created.
Collection ID The ID of the collection within the database where the attribute will be created.
Attribute Key The key or name of the attribute to be created.
Required Indicates whether the attribute is mandatory.
Default Value The default value assigned to the attribute if no value is provided.
Array Specifies if the attribute is an array of float values.
Min The minimum allowed value for the float attribute.
Max The maximum allowed value for the float attribute.

Output

JSON

  • attributeId - The unique identifier of the created float attribute.
  • key - The key or name of the created attribute.
  • type - The data type of the attribute, which is float.
  • required - Indicates if the attribute is required.
  • defaultValue - The default value set for the attribute.
  • array - Indicates if the attribute is an array.
  • min - The minimum value constraint for the attribute.
  • max - The maximum value constraint for the attribute.

Dependencies

  • Appwrite API key credential for authentication

Troubleshooting

  • Ensure the provided databaseId and collectionId are correct and exist in the Appwrite project.
  • Verify that the API key credential has sufficient permissions to create attributes in the specified database and collection.
  • Check that the min and max values are valid numbers and that min is not greater than max.
  • If the attribute key already exists in the collection schema, the operation may fail; use a unique key.

Links

Discussion