dbg()
Output a message in the query response and return the message.
Description
The dbg()
method outputs message in the query response
summary
field and returns message. It includes a preview of the
calling location.
The message template is:
info: <message>
at *<source>*:<line>:<column>
|
<line> | dbg(<message>)
| ^^^^^^^^^^^
|
where:
Field | Description | ||||||
---|---|---|---|---|---|---|---|
|
Message source.
|
||||||
|
Line number where |
||||||
|
Character offset in |
||||||
|
String-serialized |
Examples
-
Output a composed value in the query response:
Product.create({ name: "debug1", stock: dbg(1 + 2 + 3), })
info: 6 at *query*:3:16 | 3 | stock: dbg(1 + 2 + 3), | ^^^^^^^^^^^ | { id: "394873023799230528", coll: Product, ts: Time("2099-04-11T12:38:31.050Z"), name: "debug1", stock: 6 }
-
Output a Struct:
Product.create( dbg({ name: "debug2", stock: 1 + 2 + 3, }) )
info: { name: "debug2", stock: 6 } at *query*:2:6 | 2 | dbg({ | ______^ 3 | | name: "debug2", 4 | | stock: 1 + 2 + 3 5 | | }) | |____^ | { id: "394873104675897408", coll: Product, ts: Time("2099-04-11T12:39:48.180Z"), name: "debug2", stock: 6 }
-
Output a Document:
dbg( Product.create({ name: "debug3", stock: 1 + 2 + 3, }) )
info: { id: ID("394873211262599234"), coll: Product, ts: TransactionTime(), name: "debug3", stock: 6 } at *query*:1:4 | 1 | dbg( | ____^ 2 | | Product.create({ 3 | | name: "debug3", 4 | | stock: 1 + 2 + 3, 5 | | }) 6 | | ) | |_^ | { id: "394873211262599234", coll: Product, ts: Time("2099-04-11T12:41:29.835Z"), name: "debug3", stock: 6 }
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!