Working on a react native app and having issues with the Appwrite database.
here is the error:
ERROR Error seeding data: [AppwriteException: Invalid document structure: Missing required attribute "image"]
import { ID } from "appwrite";
import { databases, config } from "./appwrite";
import { agentImages, galleryImages, propertiesImages, reviewImages } from "./data";
const COLLECTIONS = {
AGENT: config.agentsCollectionId,
REVIEWS: config.reviewsCollectionId,
GALLERY: config.galleriesCollectionId,
PROPERTY: config.propertiesCollectionId,
};
const propertyTypes = [
"House",
"Townhome",
"Condo",
"Duplexe",
"Studio",
"Villa",
"Apartment",
"Other",
];
const facilities = [
"Laundry",
"Car-parking",
"Sports-center",
"Cutlery",
"Gym",
"Swimming-pool",
"Wifi",
"Pet-center",
];
I tried to check the database and I used AI to assist me with the issues that I am having problems with but it was not able to resolve the issue.[database][error while app is running]
What I tried:
I tried to change the image in the database to a string or a url - neither worked when seeding the database.
I also tried to create the images and the properties myself so that I can check if the loop runs or not and diagnose where the error might occur within the data and the code for seeding the data.
function getRandomSubset<T>( array: T[], minItems: number, maxItems: number ): T[] { if (minItems > maxItems) { throw new Error("minItems cannot be greater than maxItems"); } if (minItems < 0 || maxItems > array.length) { throw new Error( "minItems or maxItems are out of valid range for the array" ); }subsetSizeelements of the shuffled array return arrayCopy.slice(0, subsetSize); } ```