Hi,
Sorry if this is not related but its the closest thing i could find.
We are working on trying to move some functions in our realm app onto the MongoDB functions.
But we are running into errors when trying to setup objects that have realm relationships.
export const BoardColumn = {
name: "BoardColumn",
primaryKey: "_id",
properties: {
_id: "objectId",
_partition: "string",
order: "int",
zones: "BoardZone[]"
}
};
export const BoardZone = {
name: "BoardZone",
primaryKey: "_id",
properties: {
_id: "objectId",
_partition: "string",
name: "string",
order: "int",
cards: "BoardCard[]",
settings: "BoardSettings",
singleFavourite: "bool?",
singleBrainstorm: "bool?",
linkages: { type: "list", objectType: "BoardZoneLink" },
deleted: { type: "bool", default: false }
}
};
We have these two objects for example, BoardColumn has a list of BoardZone objects in a 1:M realm relationships. We don’t have any issues creating BoardZones and adding them to the BoardColumns zone field in our React Native app, but trying to do it in a mongodb function is proving difficult. Have attempted to add the objects to the filed as the objects themselves, just saving the ObjectIDs of the BoardZone objects, as well as trying to use the DBRef object as the error we are receiving is this:
could not convert foreign key link array element value to Realm link payload for path { table: \"BoardColumn\", fullPath: \"zones.0\" }: could not encode field, found a sub-document but it was not a valid DBRef: document was not a valid DBRef: DBrefs only contain 2-3 elements in the reference document (found 8)
No matter what I try I can’t seem to set them, does anyone have any idea how we can set these objects in a MongoDB function?
Thanks, Mitchell