performing batch_create with arrowdb error due to "_id" in field name

78 views Asked by At

First - fair warning for any new user, stay away from appcelerator, that team should be ashamed of the work they have performed. Read on for an example. If I am wrong I will happily admit it. The customer's data already exists and mobile application is in production using existing field names.

I am performing batch_create with (paid) account on arrowdb against their arrow cloud data source. Single queries all work well so I know there are no key or general connectivity issues. Login works, I can do manual or automatic session mgmt and all works well for queries, creates, deletes, etc.

I am using the node arrowdb 1.06 library.

Now we get to batch_create which my code looks like this after a login:

arrowDBApp.post("/v1/objects/EM/batch_create.json",
        {"json_array": [
            {
                old_id: '537280ca1316e90db2335bf7',
                old_acl_id: '5372800e1316e90da8331dac',
                idp_id: '17',
                reference: '17',
                serves: [ '52a7c0a0534b2b0b5000002b' ],
                meter: 'NO METER',
                amps: '110',
                property_id: '52a7c02612f73e0b1e0032f7'
            }
        ]},

        function (err, result) {

            if (err) {
                console.error(err.message);
            }
            else {
                console.log(result.body.meta);
            }

        }
    );

With this code I get this error: Request returned with HTTP status code 400 Invalid object at index 0: Invalid BSON id 17 And if I change the field name "idp_id" to "idpid" the problem goes away and the batch is created. Or, if I change the content from "17" to any GUID "xxxxxxxxxxxxxxxxxxxxxxxx" format.

So the question is, does anyone know a way to have "_id" in a field name without the API validating the content as having to be in the GUID format? Like I said the data exists already and we do not want to change field names and have to update the client apps (web app, mobile app, etc.).

Why would they simply validate any field with '_id'in it as a guid? They don't do it on single creates? I have hundreds of thousands of objects that have to be inserted and would like to batch create them.

thanks for any assistance. Never had anything but poor experience with ACS, always go AWS folks....

0

There are 0 answers