Unable to save Dictionary on ParseUser - parse-platform

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.

Related

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

Saving an object if not exists without using ObjectId (JS)

I'm trying to find a way to save a new object if one like it doesn't already exist with a specified custom ID.
I basically need to refresh a whole bunch of data every day but each item has its own ID set somewhere else (so not a parse objectId). I therefore can't use something like the standard save function as it'll just make a new record every time.
I've thought of trying to set the objectId of an object when its first created in the DB but I can't seem to do that... (Half expected this).
I've also thought of doing the obvious - checking if an object exists using a normal query but with a few thousand objects to compare, this will be very inefficient.
Any suggestions?
Maybe there is a save function or variation where its kind of "save or create depending if an object exists with this value in this field" :)
Thank you!
PS. I'm writing this within a Cloud Job - so JavaScript

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.

Key has no data from subclass of PFUser with reference pointer field

I need to update the current user and refetch every time the App launches so that I can grasp the most updated version of user object instead of using the one cached on the disk.
User.current()?.fetchInBackground(block: { (user, error) in
//simply using a fetchInBackground won't fetch the entire reference field store in
// the user collection. In the case of using PFQuery, we could simply include the key for
// reference field.
})
Do I have to do extra fetches for all those reference field and then update the current user's filed correspondingly?
Fetch only returns the data that is stored in your database. For a pointer, that is just a basic JSON object specifying it's a pointer, the class name, and the objectId of that object. In order to return this data, you'll instead want to use a Parse Query and include the field that you want. Include works with dot notation, so you could do something like objectAQuery.include("objectB.objectC") which will include all of the data of objectC stored as a pointer on objectB. That will not include all of objectB's data, if I'm not mistaken, though I can't say with certainty.
Finally, use query.get() to get an object with a specific objectId. This will throw an error if the object does not exist, though, so make sure you handle that appropriately. You could also use query equalTo on the objectId then call query.first(), but get would be more recommended.

how to get the keys of a collection in VB6.0

I am debugging a VB 6.0 application which deals a lot in collections. In one such scenario the application is fetching the object from a collection using text entered in a textbox as a key.
Now I want to know what key needs to be entered in the textbox for me to fetch the required object in the collection.
I think what you're asking is that given a collection of objects, and an object that you know is in that collection, how do you determine the object's key in the collection. The answer is that this value is not stored anywhere, it is only specified when you add the element to the collection. So general practice is that when you add the element, you make the collection key some property or combination of properties on the object, so that you can calculate what the key would be given the object.

Resources