Skip to content

Commit

Permalink
test(#8438): add test for sort deleted docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Terreii authored and janl committed Jul 15, 2022
1 parent 9519c74 commit 45522f7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/find/test-suite-1/test.sorting.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,37 @@ describe('test.sorting.js', function () {
});
});
});

it('#8438 exclude deleted docs', async function () {
const db = context.db;

await db.createIndex({
"index": {
"fields": ["foo"]
},
"name": "foo-index",
"type": "json"
});
await db.bulkDocs([
{_id: "a1", foo: "a"},
{_id: "a2", _deleted: true, foo: "c"},
{_id: "b1", foo: "b"}
]);

const res = await db.find({
"selector": {"foo": {$gt: null}},
"fields": ["_id", "foo"],
"sort": ["foo"]
});
res.docs.should.deep.equal([
{
"_id": "a1",
"foo": "a"
},
{
"_id": "b1",
"foo": "b"
}
]);
});
});

0 comments on commit 45522f7

Please sign in to comment.