Skip to content

Commit 5fda2d9

Browse files
DOCSP-26564 document that Database operations in Classes don't work (#323)
* DOCSP-26564 document that Database operations in Classes don't work * Update source/includes/fact-call-limitations.rst Co-authored-by: Anna Henningsen <[email protected]> --------- Co-authored-by: Anna Henningsen <[email protected]>
1 parent 967c156 commit 5fda2d9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

source/includes/fact-call-limitations.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ contexts:
66
- Class constructor functions
77
- Non-async generator functions
88
- Callbacks to ``.sort()`` on an array
9+
- JavaScript setters in classes
910

1011
To access to the results of database calls, use `async functions
1112
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function>`__,
@@ -119,3 +120,24 @@ Use ``.map()`` instead.
119120
This approach to array sort is often more performant than the
120121
equivalent unsupported code.
121122

123+
JavaScript Setters
124+
~~~~~~~~~~~~~~~~~~
125+
126+
The following JavaScript setter does not work:
127+
128+
.. code-block:: javascript
129+
:copyable: false
130+
131+
// This code will fail
132+
class TestClass {
133+
value = 1;
134+
135+
get property() {
136+
return this.value;
137+
}
138+
139+
// does not work:
140+
set property(value) {
141+
this.value = db.test.findOne({ value });
142+
}
143+
}

0 commit comments

Comments
 (0)