UBERF-7734: Fix total with find with limit === 1 (#6187)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-07-30 21:44:18 +07:00 committed by Andrey Sobolev
parent 77d09dd645
commit 62e2f18331
No known key found for this signature in database
GPG Key ID: BD80F68D68D8F7F2
2 changed files with 9 additions and 30 deletions

View File

@ -749,10 +749,14 @@ abstract class MongoAdapterBase implements DbAdapter {
} }
const doc = await coll.findOne(mongoQuery, findOptions) const doc = await coll.findOne(mongoQuery, findOptions)
if (doc != null) { let total = -1
return toFindResult([doc as unknown as T]) if (options.total === true) {
total = await coll.countDocuments(mongoQuery)
} }
return toFindResult([]) if (doc != null) {
return toFindResult([doc as unknown as T], total)
}
return toFindResult([], total)
}, },
{ mongoQuery } { mongoQuery }
) )

View File

@ -1,37 +1,12 @@
FROM node:20-alpine AS build
WORKDIR /usr/src/app
RUN apk upgrade --update && apk add \
coreutils \
libxml2-dev \
html2text \
autoconf \
automake \
build-base \
gcc
RUN cd ~ && \
wget http://www.gnu.org/software/unrtf/unrtf-0.21.9.tar.gz && \
tar xzvf unrtf-0.21.9.tar.gz && \
cd unrtf-0.21.9/ && \
./bootstrap && \
./configure && \
make && \
make install
FROM node:20-alpine AS runtime FROM node:20-alpine AS runtime
RUN apk upgrade --update && apk add \ RUN apk upgrade --update && apk add \
coreutils \ coreutils \
antiword \ antiword \
poppler-utils \ poppler-utils \
html2text html2text \
unrtf
ENV NODE_ENV=production ENV NODE_ENV=production
COPY --from=build /usr/local/bin/unrtf /usr/local/bin
RUN mkdir /usr/local/share/unrtf
COPY --from=build /usr/local/share/unrtf/* /usr/local/share/unrtf/
WORKDIR /usr/src/app WORKDIR /usr/src/app
RUN npm install --ignore-scripts=false --verbose sharp@v0.30.2 pdfjs-dist@v2.12.313 --unsafe-perm RUN npm install --ignore-scripts=false --verbose sharp@v0.30.2 pdfjs-dist@v2.12.313 --unsafe-perm
COPY bundle/bundle.js ./ COPY bundle/bundle.js ./