Home > Mobile >  Property <Object> contains an invalid nested entity. /Firebase
Property <Object> contains an invalid nested entity. /Firebase

Time:08-01

I'm trying to create a firestore collection. It gives me the error below in respose.

"Property images contain an invalid nested entity."

The attempted JSON object is below -->

{id: '', name: 'service 1', description: 'service 1 desc', status: 'ACTIVE', images: Array(5), …}

Inner images array, image object-->

{fileId: 0, fileName: 'pexels-helena-lopes-697244.jpg', fileType: 'image/jpeg', fileUrl: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD…83creJTiULjHvxWDwOY1BzDLKFS4NspmW7lTMzBg4lT//2Q==', file: File}

CodePudding user response:

Firestore can only store types that are listed in its documentation on data types. If you look carefully, you can see that your data contains a File value, which is not in the list of types that Firestore supports.

If you want to store the file's contents in Firebase, the idiomatic approach is to upload the file to Cloud Storage and then store its path (or a download URL) in Firestore.

  • Related