Open PiyushHM opened 3 years ago
What results are you getting ?
Sent from Yahoo Mail for iPhone
On Saturday, November 7, 2020, 4:24 AM, PiyushHM notifications@github.com wrote:
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);
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
with below query, I am getting empty array.
const results = database.query({ select: [], where: [ { property: "data.timestamp", }, ], order: [{ property: "data.timestamp", direction: "desc" }], limit: 10, offset: 5 });
Seems I am missing something here
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);