-
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
hi,
I am trying to create query to get items like in pagination, using offset and limit from one of the document of database.
let db = new Couchbase("database");
const data = [ { timestamp: 111, ...}, {timestamp: 112, ...}, {timestamp: 113, ...}] // lets say 10 records
let documentId = db.createDocument(
{ "data": data },
);
const results = database.query({
select: [],
where: [
{
property: "data.timestamp",
},
],
order: [{ property: "data.timestamp", direction: "desc" }],
limit: 10,
offset: 5
});
But this is not working as expected.
I tried using lodash but this is affecting UI (don't know why)
const documentId = await db.getDocument('data');
items = _.orderBy(documentId.data, data=>data.timestamp, 'desc').splice(offset, count);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels