Search record is not working in SuitesSript 1.0 - suitescript1.0

I'm getting an error when executing:
var prospectSearch = nlapiSearchRecord("prospect", null, [["email", "is", 'developer#test.com']]);
Here are the execution logs showing the error:

Related

Terraform escape quotes in the string don't work

This is a simplified Terraform code as below:
resource "datadog_monitor" "monitor_error" {
name = "error log"
type = "metric alert"
message = "There is error in the log."
query = "logs(\\\"Error\\\").index(\\\"*\\\").rollup(\\\"count\\\").last(\\\"5m\\\")>0"
}
It passed when running "terraform validate".
But it failed when running "terraform apply" with the following errors.
│ Error: error validating monitor from https://api.datadoghq.com/api/v1/monitor/validate: 400 Bad Request: {"errors":["The value provided for parameter 'query' is invalid"]}
│
│ with datadog_monitor.monitor_error,
│ on main.tf line 6, in resource "datadog_monitor" "monitor_error":
│ 6: resource "datadog_monitor" "monitor_error" {
│
╵
The debug output of terraform apply is as belows:
{"message":"There is error in the log.","name":"error log","options":{"include_tags":true,"new_host_delay":300,"no_data_timeframe":10,"notify_no_data":false,"require_full_window":true,"thresholds":{}},"priority":0,"query":"logs(\\\"Error\\\").index(\\\"*\\\").rollup(\\\"count\\\").last(\\\"5m\\\")\u003e0","tags":[],"type":"metric alert"}:
I also tried to use single slash, it failed the same thing.
What I expect is running "terraform apply", there is no error, monitor can be created.

Insert document with string containing line breaks to mongo using mongo shell

I am trying to insert the following document into a mongo collection:
[
{
"text": "tryng to insert a string
with some line breaks",
}
]
By running db.myCollection.insertMany(documentArray) where documentArray is just me copy-pasting this array.
But I am getting this error:
> db.myCollection.insertMany([
... {
... "text": "tryng to insert a string
uncaught exception: SyntaxError: "" literal not terminated before end of script :
#(shell):3:37
> with some line breaks",
uncaught exception: SyntaxError: missing ( before with-statement object :
#(shell):1:5
> }
uncaught exception: SyntaxError: expected expression, got '}' :
#(shell):1:0
> ]
Which obviously appears because it detects the new line character as the end of the command, so Mongo shell thinks it has to run the command, which is not complete.
Is there any way of saving \r\n and \n characters in MongoDB? Should I use another method not directly with the shell?
Both Mongo and the shell are version 4.4.15
Try doing this instead. The key is to embed the newline character in the string.
[
{
"text": "trying to insert a string\n" +
"with some line breaks",
}
]

mongo shell command not accept use db command

i am trying to pull records form mongo data base with json format to do that i am running below js :
conatin of get_DRMPhysicalresources_Data.js
cursor = db.physicalresources.find().limit(10)
while ( cursor.hasNext() ){
print( JSON.stringify(cursor.next()) );
}
the command i run to get the records :
mongo host_name:port/data_base_name -u user -p 'password' --eval "load(\"get_DRMPhysicalresources_Data.js\")" > DRMPhysicalresources.json
and i am able to get the result as josn formate inside DRMPhysicalresources.json , now i want to switch to other data base using use command i try add use db as below :
conatin of get_DRMPhysicalresources_Data.js
use db2_test
cursor = db.physicalresources.find().limit(10)
while ( cursor.hasNext() ){
print( JSON.stringify(cursor.next()) );
}
the command i run to get the records :
mongo host_name:port/data_base_name -u user -p 'password' --eval "load(\"get_DRMPhysicalresources_Data.js\")" > DRMPhysicalresources.json
but i am getting below errors :
MongoDB shell version v4.2.3
connecting to: "some data base info"
Implicit session: session { "id" : UUID("8c85c6af-ebed-416d-9ab8-d6739a4230cb") }
MongoDB server version: 4.4.11
WARNING: shell and server versions do not match
2022-04-11T13:39:30.121+0300 E QUERY [js] uncaught exception: SyntaxError: unexpected token: identifier :
#(shell eval):1:1
2022-04-11T13:39:30.122+0300 E QUERY [js] Error: error loading js file: get_DRMPhysicalresources_Data.js :
#(shell eval):1:1
2022-04-11T13:39:30.122+0300 E - [main] exiting with code -4
is there are any way to add use db2_test without break it ?
You can try this:
db = new Mongo().getDB("myOtherDatabase");
or
db = db.getSiblingDB('myOtherDatabase')
( this is the exact js equivalent to the 'use database' helper)
docs

Compose Transporter throws error when collection_filters is set to sync data for current day from DocumentDB/MongoDB to file/ElasticSearch

I am using Compose Transporter to sync data from DocumentDB to ElasticSearch instance in AWS. After one time sync, I added following collection_filters in pipeline.js to sync incremental data daily:
// pipeline.js
var source = mongodb({
"uri": "mongodb <URI>"
"ssl": true,
"collection_filters": '{ "mycollection": { "createdDate": { "$gt": new Date(Date.now() - 24*60*60*1000) } }}',
})
var sink = file({
"uri": "file://mongo_dump.json"
})
t.Source("source", source, "^mycollection$").Save("sink", sink, "/.*/")
I get following error:
$ transporter run pipeline.js
panic: malformed collection_filters [recovered]
panic: Panic at 32: malformed collection_filters [recovered]
panic: Panic at 32: malformed collection_filters
goroutine 1 [running]:
github.com/compose/transporter/vendor/github.com/dop251/goja.(*Runtime).RunProgram.func1(0xc420101d98)
/Users/JP/gocode/src/github.com/compose/transporter/vendor/github.com/dop251/goja/runtime.go:779 +0x98
When I change collection_filters so that value of "gt" key is single string token (see below), malformed error vanishes but it doesn't fetch any document:
'{ "mycollection": { "createdDate": { "$gt": "new Date(Date.now() - 24*60*60 * 1000)" } }}',
To check if something is fundamentally wrong with the way I am querying, tried simple string filter and that works well:
"collection_filters": '{ "articles": { "createdBy": "author name" }}',
I tried various ways to pass createdDate filter but either getting malformed error or no data. However same filter on mongo shell gives me expected output. Note that I tried with ES as well as file as sink before asking here.

db.printCollectionStats() error

I am getting the following error when I run:
db.printCollectionStats()
error: {
"$err" : "stale config on lazy receive :: caused by :: $err: \"[myzips.zips] shard version not ok in Client::Context: this shard contains versioned chunks for myzips.zips, but no version set in request ( ns : myzips.zip...\" ( ns : myzips.zips, received : 0|0||000000000000000000000000, wanted : 1|1||50fdd55b14faa2aa46422a7a, recv )",
"code" : 9996
} at src/mongo/shell/query.js:128
what does this mean?