Mango Query (Find)
CouchDB's JSON query language inspired by MongoDB. Create an index on queried fields first for performance.
Syntax
couchdb
db.find({ selector: {...}, sort: [...], limit: n })Example
couchdb
await db.createIndex({ index: { fields: ['role', 'createdAt'] } });
const result = await db.find({
selector: { role: 'admin', createdAt: { $gt: '2025-01-01' } },
sort: [{ createdAt: 'desc' }],
limit: 20,
});