Data store support for complex objects

As George noted in another thread, today we have support in data stores for complex structures like this:

however the support for such a structure stops here.

For example, when trying to insert we only see this:

This request is to be able to use the data store with complex objects. For example, I would like to be able to update a single entry in the data store, with new values. Using the structure shown above, I may want to add a phone number to the phones array, or update a single phone number.

I understand your request Ken, but do you want to use the data store as complete relational object database?

Why would you want to store a full database under a data store? What are the use cases?

The current design of the data store reflects just a single database table. If you want more you should define multiple store.

Support for a full document based database is I think a different topic and we should address it more extendible in separate document based database support features.

Let’s use the example of a recipe. A recipe has a name, prep time, etc. It then has an array of steps, and an array of notes (and I am using different array variables to store them.) It also has a list of ingredients, and those ingredients each have an array of nutritional values. I’ll stop there, but there are more things.

So when editing a recipe, all of the values might become “dirty” before saving. I need to be able to delete a note, add a step, add an ingredient with all its nutrients, etc., all before actually saving to the database.

It would be great to have a single data store that holds a list of recipes for searching, listing, etc. and then a data detail that is the current record being viewed, edited. If I take it all the way to the end, I’d like to be able to POST that data detail to server connect for processing, but today, I have a bunch of inputs either hidden or displayed that send this off to server connect. Keeping track of all the arrays with index references, etc. becomes mind boggling.

1 Like

I think fully editing deeply nested object data requires a whole new set of query builder dialogs.

For example take a document based database like MongoDB and check all the operations that are possible for manipulating objects data… and all the different update query possibilities and operations.

https://docs.mongodb.com/manual/tutorial/update-documents/

I’ll re-title my other post to Reimagined query builder dialogs. :wink:

But seriously, I would imagine it would take a significant change, but that’s what I bump into all the time.

Well manipulation of nested object data is a very different topic than just data fields picking :slight_smile: hence my confusion

Yep, my bad.

But we are already brainstorming for making new or extending the current database query builder and updated dialogs to support nested json data.

That is probably what you need but then client side as well.

Server side it is also much needed as more people want to use json database fields or document based databases like mongodb - so you are actually manipulating nested object data.

1 Like

As a reference all the different database providers have different techniques (non standard) to manipulate JSON data:

https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html

and that makes it also difficult to find an universal solution - and then make a universal great looking UI for it :slight_smile:

1 Like

Just start with postgresql :wink:

3 Likes

Plus one for me on Postgres :blush:

2 Likes

Would my post below also fall into this need for improving the database query builder for JSON columns?

This feature would be great for my use case atm:

To not reload all data on live refresh with sockets, I was planning to insert all data from the server connect on page load, and then add a record from each socket event. In the data I require nested arrays…

2 Likes

Bumping this, it would be amazing to have it in Wappler 5. Very useful to create light-weight real time experiences.

Loading data once into data store + adding rows from socket events > Reloading all data (unnecessarily) when only 1 row changes

1 Like