Hello!
I’m trying to create 2 documents within the same operation. The goal is to have one of them link to another via the ref. How can I do that?
Currently I’ve tried the following approach:
Map(
[
[
"collection1",
{
coll1Prop1: "12345",
}
],
[
"collection2",
{
collection1Ref: Call(Function("getDocRefByProp1"), "12345"),
collection2Prop2: "randomProp"
}
]
],
Lambda(["collection", "data"],
Create(
Collection(Var("collection")),
{
data: Var("data")
}
)
)
)
In this example I’m also using a Function getDocRefByProp1
, which, as the name implies, returns the ref of document from collection1 by coll1Prop1
property.
I’m currently getting the following error:
Error: [
{
"position": [
"collection",
1,
1,
"object",
"collection1Ref"
],
"code": "call error",
"description": "Calling the function resulted in an error.",
"cause": [
{
"position": [
"expr",
"from"
],
"code": "instance not found",
"description": "Set not found."
}
]
}
]
Thank you in advance!