瀏覽代碼

scoper on find query.by default adds limit 100

Ivan Asmer 5 年之前
父節點
當前提交
36dd925ef0
共有 1 個文件被更改,包括 7 次插入5 次删除
  1. 7 5
      expand.js

+ 7 - 5
expand.js

@@ -1,11 +1,13 @@
 const { buildSchema, GraphQLObjectType, GraphQLString, GraphQLInt, GraphQLList, GraphQLSchema } = require('graphql');
 const ObjectID    = require("mongodb").ObjectID;
 const bound       = 100;
-function scoper(query,cursorCalls=[{},{limit:[limitValue=100]}]) {
-    console.log(limit)
-    return params
-}
-function mmExpandSchema(gqlSchema, defaultQueryFields, defaultMutationFields, scoper=scoper){
+function mmExpandSchema(gqlSchema, defaultQueryFields, defaultMutationFields, scoper){
+    function scoperTest(query,cursorCalls=[{},{limit:[limitValue=100]}]) {
+        console.log(limit)
+        return params
+    }
+    scoper=scoper || scoperTest
+
     const types    = {}
     const _typeMap = gqlSchema.getTypeMap()