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: 3168
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

HenryM
Posts: 2
Joined: Tue 15 Dec 2020 20:19

Re: MongoDB Query Error - Invalid Array!!

Post by HenryM » Thu 04 Mar 2021 09:34

Thanks for the valuable advice, I have been looking for this information for a long time. 192.168.1.1

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

Re: MongoDB Query Error - Invalid Array!!

Post by ViktorV » Fri 05 Mar 2021 09:38

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.

Post Reply