Query for MongoDB - Data360_Analyze - Latest

Data360 Analyze Server Help

Product type
Software
Portfolio
Verify
Product family
Data360
Product
Data360 Analyze
Version
Latest
Language
English
Product name
Data360 Analyze
Title
Data360 Analyze Server Help
Copyright
2024
First publish date
2016
Last updated
2024-11-28
Published on
2024-11-28T15:26:57.181000

Performs queries on a MongoDB database and outputs the results as JSON documents.

The node accepts a "document" containing query criteria that identify the documents to be returned from the MongoDB "collection", and a "Projection" document can be used to specify the fields that are to be returned from the matching documents. See the list of properties below for additional details.

The node outputs the MongoDB query results as JSON documents. The results may be output to a file or in a field on the node's data output pin. Depending on the configuration, the node can be configured to sort the results, return a maximum number of results and skip a specified number of initial documents in the collection before returning results.

See:

Properties

Query

Optionally specify a MongoDB query to determine which documents are retrieved.

In this property, enter only the information that you would pass as a parameter to the find() method in the MongoDB shell e.g.

<property value> in the following example:

db.collection.find( <property_value> )

If you do not specify a value, all records in the collection are returned.

See the MongoDB documentation for more information: http://docs.mongodb.org/manual/core/read/

  • Choose the (from Query) variant of this property to specify the query in the property value.
  • Choose the (from Query Field) variant of this property to specify the name of the field in the input data pin, which contains the queries.
  • Choose the (from Filename) variant of this property to specify the name of the file containing the query.
  • Choose the (from Filename Field) variant of this property to specify the name of the field on the input data pin, which contains the names of the files containing the query.

Output

Optionally specify the destination of the query result.

  • Choose the (from Filename) variant of this property to specify the name of the file to output the query result.
  • Choose the (from Filename Field) variant of this property to specify the name of the field in the input data pin, which contains the names of the files in which to output the query results.
  • Choose the (from Data Field) variant of this property to specify the name of a field in the 'data' output to output the query results.

Collection

Specify the MongoDB collection on which to perform the query.

Choose the (from Field) variant of this property to look up the value from an input field with the name specified.

A value is required for this property.

Server

Optionally specify the server to connect to.

The default value is localhost.

Port

Optionally specify the port on which the server is running.

The default value is 27017.

Username

Optionally specify the database username.

Password

Optionally specify the database password.

Database

Specify the database name.

A value is required for this property.

AuthDatabase

Optionally specify the authorization database name.

If unset it will default to "admin".

Projection

Optionally specify a MongoDB document that defines the fields to return.

Choose the (from Field) variant of this property to look up the value from an input field with the name specified.

Sort

Optionally specify a MongoDB document that defines the sort order.

Choose the (from Field) variant of this property to look up the value from an input field with the name specified.

Limit

Optionally specify the maximum number of documents that are returned.

The default is no limit.

This is analogous to the LIMIT statement in a SQL database.

Choose the (from Field) variant of this property to look up the value from an input field with the name specified.

Skip

Optionally specify a number that defines the initial cursor position at which results are returned.

The default value is 0.

Hint

Optionally specify the index for MongoDB to use when performing the query.

Specify the index either by the index name or by the index specification document.

EncloseInDoubleQuotes

If you have specified an output destination, optionally specify whether to enclose the query result in double quotes.

The default value is False.

QuoteFieldNames

Optionally specify whether JSON Object field names are quoted using double-quotes, as specified by JSON specification or not. The ability to disable is to support use cases where they are not usually expected, which most commonly occurs when used straight from Javascript.

The default value is True.

QuoteNonNumericNumbers

Optionally specify whether "exceptional" (not real number) float/double values are output as quoted strings. The values checked are Double.Nan, Double.POSITIVE_INFINITY and Double.NEGATIVE_INFINITY (and associated Float values). If feature is disabled, these numbers are still output using associated literal values, resulting in non-conformant output.

The default value is True.

WriteNumbersAsStrings

Optionally specify whether to force all Java numbers to be written as JSON strings.

The default value is False.

QueryPageSize

Optionally specify the number of documents, returned by the query, that will be processed before outputting the results.

If set to 0, all documents will be processed before outputting the result.

The default value is 0.

OutputCompoundDataTypes

Optionally specify whether MongoDB data types that are not supported by JSON are serialized as compound data types or converted to a compatible type.

For example, the MongoDB date type is not supported by the JSON specification.

If this property is set to True, then a date object will be serialized as follows: "dateOfBirth" : { "$date" : 1513075180000 }

If this property is set to False, then the same date object will be serialized as an ISO 8601 string: "dateOfBirth" : "2017-12-12T10:39:40.000Z"

The default value is True.

CAUTION:
If this property is set to True (default), ByteArray objects will be output using base64 encoding. If this property is set to False, the data is not encoded. This may affect subsequent handling of this data and possibly lead to data corruption.

PassThroughFields

Optionally specify which input fields will "pass through" the node unchanged from the input to the output, assuming that the input exists. The input fields specified will appear on those output records which were produced as a result of the input fields. Choose from:

  • All - Passes through all the input data fields to the output.
  • None - Passes none of the input data fields to the output; as such, only the fields created by the node appear on the output.
  • Used - Passes through all the fields that the node used to create the output. Used fields include any input field referenced by a property, be it explicitly (i.e., via a "field1" reference) or via a field pattern (i.e., "1:foo*").
  • Unused - Passes through all the fields that the node did not use to create the output.

The default value is Used.

If a naming conflict exists between a pass-through field and an explicitly named output field, an error will occur.

SSL

Optionally specify whether communication with the database will be made with an SSL connection.

The MongoDB server must support SSL if this is set to true.

The default value is False.

ErrorThreshold

Optionally specify the number of transfer errors that will cause the node to give up and fail.

Each record on the input pin is a "request". A transfer error is any error that causes a request to fail (e.g. a requested file does not exist). Setting this property instructs the node to continue processing requests as long as the number of errors remains below the given threshold.

An ErrorThreshold of 0 means never fail on a transfer error (the node will still fail on more serious errors).

The default value is 1 i.e. the node fails on the first error encountered.

NullDataBehavior

Optionally specify the behavior of the node when the node is processing data from an input pin, and the data is null. Choose from:

  • Error
  • Log
  • Ignore

Note that this only has affect when there is an input to the node, and the DataSource is set to be a Filename Field or Data Field, and the specified field is null for a given record.

The default value is Ignore.

LogConfig

The optional LogConfig property is rarely given a value. By default, the JavaNode creates a parsable (i.e., xml) log in the usual place, namely the directory ({{^logTempDir^}} /user/data flow/run_name/. Its logging threshold is set by the LogLevel property.

Customization of JavaNode logging is achieved by specifying an XML text value for the LogConfig property. You can create multiple logs, each of which filters log events by LogLevel and/or ErrorCode or some other user-defined logic supplied as a Java class. A log can also subscribe to events generated by another log.

Inputs and outputs

Inputs: 1 optional.

Outputs: Data, Errors.