MongoDB Query Error - Invalid Array!!

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
farukhcasy2
Posts: 4
Joined: Wed 08 Apr 2020 17:28

MongoDB Query Error - Invalid Array!!

Post by farukhcasy2 » Sat 02 May 2020 07:46

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?
Last edited by farukhcasy2 on Sat 09 May 2020 06:08, edited 1 time in total.

ViktorV
Devart Team
Posts: 2850
Joined: Wed 30 Jul 2014 07:16

Re: MongoDB Query Error - Invalid Array!!

Post by ViktorV » Fri 08 May 2020 16:31

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

Post Reply