We have the following docs
{
id:A,
deleted: true
}
{
id:B
deleted: false
}
{
id:C
}
What is the best way to get all the docs not deleted. (A and C)
Is this the best way?
Select *
From bucket
Where (Not deleted or deleted IS MISSING)
We have the following docs
{
id:A,
deleted: true
}
{
id:B
deleted: false
}
{
id:C
}
What is the best way to get all the docs not deleted. (A and C)
Is this the best way?
Select *
From bucket
Where (Not deleted or deleted IS MISSING)
CREATE INDEX ix1 ON bucket(meta().id) WHERE (deleted = true OR deleted IS MISSING);
SELECT * FROM bucket WHERE META().id > "" AND (deleted = true OR deleted IS MISSING);
As META().id is string and always present so you can index and use as > “”
OR
CREATE INDEX ix1 ON bucket(IFMISSING(deleted,1));
SELECT * FROM bucket WHERE IFMISSING(deleted,1) IN [true,1];
Do you mean you want documents B and C? In that case, this query should work just fine:
select * from bucket where deleted != true