I’m seeing a repeatable bug when trying to modify a field which is an array of ObjectIDs.
If I use some other tool (MongoDB Compass or Python), I can readily create records that have array of ObjectIDs. DreamFactory REST API is able to GET these, like this:
{
"resource": [
{
"_id": "5c86919fe0e8ca62bcc4e1ae",
"name": "group_C",
"desc": "CCC",
"date1": {
"$date": "2019-01-01T00:00:00+00:00"
},
"date2": {
"$date": "2019-01-02T00:00:00+00:00"
},
"sensors": [
{
"$oid": "5c65d1db2889652d840b31de"
},
{
"$oid": "5c65d1db2889652d840b31dc"
}
]
}
]
}
Note the two “$oid” fields in the “sensors” array.
But attempting to POST, PUT, or PATCH works ONLY if I limit the “sensors” field to ONE ObjectID:
"sensors": [
{
"$oid": "5c65d1db2889652d840b31de"
}
]
If I try to use two like this:
"sensors": [
{
"$oid": "5c65d1db2889652d840b31de"
},
{
"$oid": "5c65d1db2889652d840b31dc"
}
]
I get this error:
{
"code": 22,
"message": "invalid document for insert: keys cannot begin with "$": "$oid""
}
Help! I’m using DreamFactory 2.12.0.