Loading TOC...

xdmp.setSessionField

xdmp.setSessionField(
   $name as String,
   $value as Sequence
) as Sequence

Summary

Sets the value of a named session field for the session created by the xdmp:login function.

Parameters
$name The name of the session field.
$value The value of the session field. If you pass in a single value, it is treated as a Sequence with that single item; therefore, if you pass in an array, the array is treated as a single value (not as one value for each item in the array). If you mean to pass in the values of each item in the array, then you can call xdmp.arrayValues on the array.

Required Privileges

http://marklogic.com/xdmp/privileges/xdmp-set-session-field

Usage Notes

You can use the xdmp:get-session-field-names function to return the names of the fields in the session and the xdmp:get-session-field function to return a value set in a session field.

If you set a session or server field to a value that comes from a database node (for example, from the value of a search or the fn:doc function), then that session or server field expires after the request time limit (10 minutes by default). These fields expire because they contain references to stands in the database, and as long as those references exist the stand cannot be reclaimed (merged). To keep such a node in a session or server field, make a copy of the node before adding it to the session or server field instead of using the node directly from the database.

Example

xdmp.setSessionField("user", "marklogic");
=> "marklogic"

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy