In application development, especially for scenarios like a messaging app, it is often necessary to handle user-deleted content in a way that preserves the record of its existence, such as by using a "deleted" flag in the data rather than removing the data entirely. For efficient data retrieval, a global secondary index (GSI) can be created to quickly access these flagged records. When introducing such a feature to an existing dataset, where many records might lack the "deleted" flag, developers might initially consider using a query with the N1QL IS MISSING keyword to account for these instances. However, this approach is inefficient as it requires a full document scan. A more efficient method involves running a one-time background task to update all records missing the flag to include "deleted: false," ensuring all documents are indexed appropriately. An alternative approach to avoid using the MISSING keyword is to implement schema versioning, where the background task upgrades documents with outdated schema versions to the new version, adding the necessary deleted flag in the process.