I’m attempting to populate two tables using corresponding wixData.query functions on a collection (see below) containing ~3200 items, where multiple items have the same values for the first property, constituency_name:
@jonatandor35 In Preview, the console.log’s show the expected wixDataQueryResult items and this matches what is passed to the tables - an array.length of 5 and an array.length of 4.
On my published site, the logged wixDataQueryResult’s show the unexpected behaviour like the tables, tested in Chrome developer console - two arrays of array.length 15, which is really weird considering the expected item array lengths are different, and no limit is set in the query.
@jonatandor35 OK, thanks for letting me know J. D. I’ll give it another day and see if it gets picked up on the front page of the Community Discussion.
Have you check your collection permission? In editor code is execute as admin so It would works everytime. But on live you might be logged as visitor and might not have the permission to change/view data
@ryanmorgan you cannot use suppressAuth in the front end but you don’t need to.
Just go to your collection and set the permissions.
Anyway, I think you’re right and it should be empty if the permissions are wrong.
@jonatandor35 This is really weird and frustrating. I have several other wixData.query functions on my site all working fine, it’s just these two supplying items to the tables refuse to behave! Where/who else could I turn to? Thanks for your ongoing help BTW.
I’ve found the issue. It’s not in the wixData.query itself but in my collections. When I’ve been syncing sandbox data to live data, it’s been duplicating it, so my TableData collection has three copies of every item! Why did this happen?