This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
@msajones The MongoDB Input tool when in automatic mode uses strict extended json for the criteria field. As such you have to specify the full exact json criteria for the find command to get the results you want without errors. For example your criteria for LastKnownId strings starting with 'A333335' would be:
Adding other fields to this criteria is pretty simple as long as you keep this in mind. So if you wanted both the above string and documents where Color1 is NULL and/or if ValueG is true your criteria would be:
**Note: for the ValueG examples I removed the leading white space from the field name assuming it was a typo. If the field does contain the white space this will need to be included in the above criteria. In this case replace 'Settings.Settings.ValueG' with 'Settings.Settings. ValueG'
For more information on strict extended JSON or the criteria options available for the find function please reference the following MongoDB documentation:
@msajones If you are referring to limiting the number of results provided by a MongoDB query you would add .limit(x) to your query. So for example a find statement with a limit of 100 results would look something like this:
Our MongoDB Input tool already encompasses this functionality with the Record Limit option. This option allows you to specify the integer value for the record limit and automatically applies the limit as per the above query example where 100 is replaced with the value specified.
If you are talking about limiting the fields returned this could in theory be done via the filter criteria. You would need to provide an appropriate expression to specify the fields you wanted. Considering the previous examples if we only want to return the same fields we are filtering on the criteria expression should look like this:
This example is based on MongoDB's documentation, but I wasn't able to get it to function as expected when I tested it. I am guessing since this is the only way select if a field is shown or not, that we are already appending this to the criteria in order to allow for the 'Include Mongo _id Field' option. If so this would explain why the query doesn't work as expected if you specify the fields manually. For more information you can reference:
Since this additional query criteria doesn't seem to function in the tool the best option to work around this is to use a Select tool after the MongoDB Input. The Select (or Dynamic Select) tool will allow you to choose which fields you want to keep or not keep as needed.