summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/nested_code_with_scope.js
blob: 81ba2cdaf2168391ed81601ce6987b0e376f9cb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SERVER-44366 Test that nesting of CodeWithScope works properly

(function() {
"use strict";
const nestedCWS = Code("function(){return 1;}", {
    f: Code("function(){return 2};", {
        f: Code("function(){return 3};", {
            f: Code("function(){return 4};", {
                f: Code("function(){return 5};", {
                    f: Code("function(){return 6};", {
                        f: Code("function(){return 7};", {
                            f: Code("function(){return 8};", {
                                f: Code("function(){return 9};", {
                                    f: Code("function(){return 10};", {
                                        f: Code("function(){return 11};", {
                                            f: Code("function(){return 12};", {
                                                f: Code("function(){return 13};", {
                                                    f: Code("function(){return 14};",
                                                            {f: Code("function(){return 15};", {})})
                                                })
                                            })
                                        })
                                    })
                                })
                            })
                        })
                    })
                })
            })
        })
    })
});
var conn = MongoRunner.runMongod({setParameter: "maxBSONDepth=30"});
var testDB = conn.getDB("nestedCWS");
var coll = testDB.getCollection("test");
coll.insert({_id: nestedCWS});

MongoRunner.stopMongod(conn);
})();