How to fix mgp.Vertex.properties not JSON serializable? - memgraphdb

I am creating a query module in Memgraph and I am creating a dictionary for every node in the database. I am trying to add properties of a node as a list to my properties key, but then I get mgp.Vertex.properties not JSON serializable error. What is the best way to solve this?

This is happening because mgp objects are not JSON serializable, and there is a feature request opened for that. But, to avoid such error for now, you can do similar to what is implemented in the export_util.py query module. You iterate over all properties for every node and depending on the property type, set value for every key.

Related

Filtering CassandraRepository by multiple fields dynamically

I need to filter on multiple fields of an entity dynamically when searching the CassandraRepository.
Specifically, there are multiple String fields of the entity. The user can indicate which (if any) of these fields they want to match a specified Regular expression (e.g., ".*").
However, it looks like CassandraRepository doesn't provide support for JpaSpecificationExecutor, which is what resources online typically suggest using for this purpose, giving the following issue:
Could not create query for public abstract Page JpaSpecificationExecutor.findAll(Specification, Pageable)! Reason: Page queries are not supported. Use a Slice query.
What is the appropriate way to approach this issue?
Based on the research I have done, the closest you can get is creating your own CQL Query String based on the inputs provided, and executing them on a CassandraOperations Object that you can autowire into the necessary class.

Save Related Documents In Mongo Reactive But Not In The Same Collection

I would like to know, how to save related documents in reactive mongo ?. Because I find a code that attempts to do the magic... But when it should save the related document in another collection, it serializes inside the "father" of the relationship let say... I know that in spring data reactive mongo, #DbRef doesnt have support... How could I save the data in a way that, if I query the collection, I see that the attributesare the name of the collection and the generated id instead all of the object attributes ?.
If the pic above is seen, you will see that the attribute "user" is saved as a nested document but not in the corresponding collection. Do I need to hook in another event ?.
I had put a listener onbeforeconvert to scan every time a save operation is to be applied and save the object... How to proceed ?... think I should verify if it has a related doc from another collection and if its nonnull... If the object doesnt have any attr l
Alike, then save it... if not continue the scanning... dunno

Square Connect API V2: Partial updates to catalog objects?

In the V2 api, is there a way to partially update a catalog object? For example, if I have an item, and I don't want to keep track of modifier_list_info, it seems I have to send that data with any upserts otherwise it will get wiped out.
Is there a way to specifiy a partial update?
The best way to update a catalog object would be to first retrieve the object (https://docs.connect.squareup.com/api/connect/v2#endpoint-retrievecatalogobject), and then edit the properties you need to change. For instance, the response will have an object field so
response.object.item_data.name = 'Food'
will change the name to 'Food'. Then pass the entire object back to the UpsertCatalogObject endpoint. This will keep all the same properties except for changing the name.

Unable to save Dictionary on ParseUser

Trying to save a Dictionary as a field on a ParseUser object, but its not working. Its a pretty straightforward:
//updateDict does implement IDictionary<string,T>
ParseUser.CurrentUser["ItemsStatus"]= updateDict;
ParseUser.CurrentUser.SaveAsync()
I've already checked to see if my dictionary has values, and I can save the user without issue if I remove the update to the dictionary field. But if I try to add that value I just get a 400 Bad Request "Other Cause" response from parse when I call the save task. Any thoughts?
A dictionary is not a valid Parse data type.
You need to either add the elements of the dictionary to the User object individually or create a new Parse object with the elements from updateDict and create a relation to that.

Caching in an excel document level customization in vsto

I have a document level customization in excel that is used to calculate and save quoting data. Basically each sheet is a quote with specific cells containing QuoteNo, Description, Totals etc.
I want to be able to extract this data into a list of POCO objects that is then cached as a property in the ThisWorksheet class.
I get the error
The Cached attribute on the following member is in error because the
member is not public, static, read-only, or is a parameterized or
indexer property
I believe that this is because a list has an indexer property.
So how can I store this type of data in the cache?
OK, not my preferred solution but it solves the problem.
I add a method to the class that inherits from list that creates xml with the relevant data. The BeforeSave event is used to add (or update) this xml to the customXmlParts. Other documents can then access this and de-serilaise it.
Clunky but it works, does anyone have anything more elegant?

Resources