- Storing Image as a Base64 String
Convert the selected image into a Base64 string and store it as a string in MongoDB.
Pros: Simple and avoids dealing with file storage.
Cons: Increases database size significantly because Base64 encoding adds ~33% overhead.
Example:
`const image = await ImagePicker.launchImageLibraryAsync({ base64: true });
const base64Image = image.base64;
// Save to MongoDB
const imageDocument = { image: base64Image };
await db.collection('images').insertOne(imageDocument);`