QFix: add limit to count queries (#7458)

Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
Artyom Savchenko 2024-12-14 00:34:46 +07:00 committed by GitHub
parent 5b1f0a6c35
commit a122f866e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 26 additions and 10 deletions

View File

@ -106,9 +106,14 @@
const starredQuery = createQuery()
let isStarred = false
$: starredQuery.query(document.class.SavedDocument, { attachedTo: _id }, (res) => {
isStarred = res.length !== 0
})
$: starredQuery.query(
document.class.SavedDocument,
{ attachedTo: _id },
(res) => {
isStarred = res.length !== 0
},
{ limit: 1 }
)
async function createEmbedding (file: File): Promise<{ file: Ref<Blob>, type: string } | undefined> {
if (doc === undefined) {

View File

@ -34,9 +34,11 @@
products.class.ProductVersion,
{ space: objectId },
(res) => {
versions = res.length
versions = res.total
},
{
total: true,
limit: 1,
projection: { _id: 1 }
}
)

View File

@ -30,9 +30,14 @@
let applications: number
const query = createQuery()
$: query.query(recruit.class.Applicant, { space: objectId }, (res) => {
applications = res.length
})
$: query.query(
recruit.class.Applicant,
{ space: objectId },
(res) => {
applications = res.total
},
{ total: true, limit: 1 }
)
const createApp = (ev: MouseEvent): void => {
showPopup(CreateApplication, { space: objectId, preserveVacancy: true }, ev.target as HTMLElement)

View File

@ -47,10 +47,12 @@
core.class.TypedSpace,
{ type: type._id },
(res) => {
spacesCount = res.length
spacesCount = res.total
loading = false
},
{
total: true,
limit: 1,
projection: { _id: 1 }
}
)

View File

@ -71,9 +71,11 @@
task.class.Task,
{ kind: taskType._id },
(res) => {
tasksCounter = res.length
tasksCounter = res.total
},
{
total: true,
limit: 1,
projection: {
_id: 1
}

View File

@ -29,7 +29,7 @@
testManagement.class.TestCase,
query,
(res) => {
testCases = res.length
testCases = res.total
},
{ total: true, limit: 1 }
)