Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/vulcan-core/lib/modules/default_resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { createError } from 'apollo-errors';

const defaultOptions = {
cacheMaxAge: 300,
maxCountQuery: 500
};

// note: for some reason changing resolverOptions to "options" throws error
Expand Down Expand Up @@ -80,7 +81,7 @@ export function getDefaultResolvers(options) {

if (enableTotal) {
// get total count of documents matching the selector
data.totalCount = await Connectors.count(collection, selector);
data.totalCount = await Connectors.count(collection, selector, {limit: resolverOptions.maxCountQuery});
}

// return results
Expand Down
2 changes: 1 addition & 1 deletion packages/vulcan-lib/lib/server/connectors/mongo.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ DatabaseConnectors.mongo = {
return await collection.find(convertSelector(selector), options).fetch();
},
count: async (collection, selector = {}, options = {}) => {
return await collection.find(convertSelector(selector), options).count();
return await collection.find(convertSelector(selector), options).count(options);
},
create: async (collection, document, options = {}) => {
return await collection.insert(document);
Expand Down