Page 1 of 1

MongoDB Query Error - Invalid Array!!

Posted: Sat 02 May 2020 07:46
by farukhcasy2
Dear All,
i've probles to make queries when the data tipe is complex

{
"_id" : "DC396F11E04B",
"events" : {
"0 BOOTSTRAP" : true
},
"precondition" : "VirtualParameters.SerialNumber = \"DC396F11E04B\"",
"weight" : NumberInt(0),
"configuratio10.0.0.0.1 192.168.1.254 happymod

{
"type" : "provision",
"name" : "DC396F11E04B",
"args" : null
}
]
}

in this case when i use the find command i've invalid array error

how i can fix it?

Re: MongoDB Query Error - Invalid Array!!

Posted: Fri 08 May 2020 16:31
by ViktorV
1. The element "weight" : NumberInt(0)
We don't support MongoDB number aliases https://docs.mongodb.com/manual/referen ... e-examples. Currently, we support the following BSON types https://docs.mongodb.com/manual/reference/bson-types/, that are represented in the Extended JSON format: https://docs.mongodb.com/manual/referen ... nded-json/ .
Thus, the element in the example should be written as "weight" : { "$numberInt": "0" }

2. "configurations" : [10.0.0.0.1 192.168.1.254 happymod
{
"type" : "provision",
"name" : "DC396F11E04B",
"args" : null
}
]
the above JSON array contains errors:
- if the first element of the array (10.0.0.0.1 192.168.1.254 happymod) is a string, it must be enclosed in double quotes;
- missing comma separator after the first element of the array.
See the JSON documentation for more information: https://www.json.org/json-en.html

Re: MongoDB Query Error - Invalid Array!!

Posted: Thu 04 Mar 2021 09:34
by HenryM
Thanks for the valuable advice, I have been looking for this information for a long time. 192.168.1.1

Re: MongoDB Query Error - Invalid Array!!

Posted: Fri 05 Mar 2021 09:38
by ViktorV
Thank you for the interest to our product.
If you have any questions during using our products, please don't hesitate to contact us - and we will try to help you solve them.