I am having a bit of problem debugging a query. It keep showing the message: Uncaught (in promise) Error: _id may only be typed 'string', have a maximum length of 128 characters and include alphanumeric characters and punctuation characters [ !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ ]
However the query was working fine before, just now suddenly it doesn't and can't figure out where suddenly went wrong. Here is the query. I tried to insert with array or with a single string, and it showed the same error message which I feel really puzzled about.
wixData.query("PrototypeCoffee") .find() .then(result => { let item = result.items; let yesCoffeeId = String(item[1]._id) return wixData.query("PrototypeSocial") .find() .then(done=>{ let coffeeTableId = String(done.items[1]._id) return wixData.queryReferenced("PrototypeCoffee", yesCoffeeId, "PrototypePersonalData") .then(done1 => { let totalCount = done1.items.length; let toInsert = []; for (let i = 0; i < totalCount; i++) { let personId = String(done1.items[i]._id) toInsert.push(personId); } console.log(toInsert); return wixData.insertReference("PrototypeSocial", "people", coffeeTableId, toInsert) .then(done2 => { console.log("success") }) .catch(console.log("error")) }) }) })
Hello,
I wanted to know, why are you interested in the second item of all the results? (you re
looking at [1] - second place in the array). Maybe this could be linked to the error...