Write Document

Operation Name

Write Document

Function Overview

Writes input data to a collection.

Data model

Table Model type.

Properties

For information about using variables, refer to "Variables".
Basic settings
Item name Required/Optional Use of variables Description Remarks
Name Required Not available Enter the name to show on the script canvas.  
Input data Required Not available Select a component on the script campus.  
Required settings
Item name Required/Optional Use of variables Description Remarks
Destination Required Not available Select a global resource.
  • [Add]:
    Adds a new global resource.
  • [Rewrite list]:
    Enables to edit the global resource settings in the "Edit resource list".
 
Collection name Required Available Enter or select the name of the colletion to write to
Update when _id value matches Optional Not available Select whether to update rows of which _id values match or insert all rows.
  • [Checked]:(default)
    Rows of which _id values match are updated. Rows of which _id values don't match are inserted.
  • [Not checked]:
    All rows are inserted.
Schema definition Required - Displays the schema definition of the selected colletion at [Collection name].
  • Among the columns displayed at[Schema definition], the item names checked at the [Write target] are displayed at schemas of Mapper.
  • _id is necessary to exist in the schema definition.
  • Schema definition cannot be displayed in the following cases.
    • There is no permission to read the specified collection
    • The specified collection doesn't exist
    • A variable is specified in [Collection name]
    • Nothing is entered in [Collection name]
    • An error occurs at [Collection name]
Schema definition/Write target Optional Not available Select whether to include the columns of the collection specified at[Collection name] in columns to write.
  • [Checked]:(default)
    Includes it in columns to write.
  • [Not checked]:
    Does not include it in columns to write.
  • The item name of the checked columns will be displayed on Mapper schemas.
  • Pushing the checkbox displayed at the header enables to check and uncheck all at once.
  • _id must be checked.
Schema definition/Item name Required Available Displays the item names of the collecion specified at [Collection name].  
Schema definition/Type Required Not available Displays the type of the [Item name].
  • Displayed as "<Internal data type>" form.
    • Internal data type:
      Data type used internally in DataSpider.
      For details, refer to "Internal data type".
Property action
Item name Description Remarks
Update collection name list Shows the collection name list that exists in the destination specified in [Destination].
  • If [Destination] is selected, it is enabled.
Update schema definition Updates the schema definition of collection specified in [Collection name].
  • It is disabled in the following cases.
    • If read authorization does not exist in the specified collection
    • If the specified collection does not exist
    • If no document exists in the specified collection
    • If variable is specified in [Collection name]
    • If [Collection name] is not entered
    • If error occured in [Collection name]
Write settings
Item name Required/Optional Use of variables Description Remarks
Batch size Optional Available Specify the number of batch update.
  • The default value is "1000", and "1000" is set if omitted.
  • The range of valid value is 1-2147483647.
Comment
Item name Required/Optional Use of variable Description Remarks
Comment Optional Not available You can write a short description of this adapter.
The description will be reflected in the specifications.
 

Schema

Input schema

Column number differs depending on the [Schema definition] setting.
Refer to "Table model type schema" for schema structure.

Output schema

None.

Loading Schema in Mapper

Schema is loaded automatically.
For details, refer to "Edit schema".

Transaction

Transaction is not supported.

PSP Usage

PSP is supported.
For details on PSP, refer to "Parallel Stream Processing".

Available Component Variables

Component variable name Description Remarks
count Stores the number of written data.
  • Default value is null.
insert_count Stores the number of inserted data within the written data.
  • Default value is null.
update_count Stores the number of updated data within the written data.
  • Default value is null.
message_category Stores the category of message code corresponding to the occurred error.
  • Default value is null.
message_code Stores the code of message code corresponding to the occurred error.
  • Default value is null.
message_level Stores the severity of message code corresponding to the occurred error.
  • Default value is null.
error_type Stores the error type of occurred error.
  • Default value is null.
  • Error is represented in the format depicted below.
    Example: “java.io.FileNotFoundException”
  • The value may vary depending on the DataSpider Servista version.
error_message Stores the error message of occurred error.
  • Default value is null.
  • The value may vary depending on the DataSpider Servista version.
error_trace Stores the trace information of occurred error.
  • Default value is null.
  • The value may vary depending on the DataSpider Servista version or the client application used.

Columns targeted to write

Behavior on insertion (with _id in input data)

When inserting, the columns of which [Schema definition/Write target] is checked are used as the target columns to insert.
Example:

Behavior on insertion (without _id in input data)

When inserting, the columns of which [Schema definition/Write target] is checked are used as the target columns to insert.
The values numbered automatically by MongoDB will be stored in _id.
Example:

Behavior on updating

When updating, the columns of which [Schema definition/Write target] is checked are used as the target columns to insert.
The values of columns excluded from write targets are not updated and retained.
If input data include data which have not existed before processing, that is inserted.
Example:

Specification Limits

Main Exceptions

Exception name Cause Solution
InputDataNotFoundException [Input data] is not specified Specify [Input data], or draw a data flow.
ResourceNotFoundException
Resource is not defined. Name:[]
[Destination] is not specified. Specify [Destination].
ResourceNotFoundException
Resource is not defined. Name:[<Global resource name>]
Resource definition selected in [Destination] is not found. Check the global resource specified in [Destination].
MongoTimeOutException
'Authentication failed.'
There is something wrong with the user name or the password of the global resource specified in [Destination], or the user does not have permission. Check the global resource specified in [Destination].
InvalidPropertyConfigurationException
Enter collection name.
[Collection name] is not specified. Specify [Collection name].
InvalidPropertyConfigurationException
Specify _id of the schema as write target.
_id is not specified as [Write target] in [Schema definition] Specify _id as [Write target] in [Schema definition]

Notes