I am using Ceramic One, and created a model with accountRelation “set”, where I am setting two fields as it can be seen in the following code providing the model:
const DeploymentIndexModel: ModelDefinition = {
version: "2.0",
name: "DeploymentIndex development",
description: "A unique anchor document for a specific application deployment development",
// This model is controlled by an admin/system DID.
// Each deployment is a unique instance.
accountRelation: { type: "set", fields: ["environment", "deployment_version"] },
interface: false,
implements: [],
schema: {
type: "object",
properties: {
// Human-readable name for the deployment
environment: { type: "string" },
// Optional version for this deployment
deployment_version: { type: "string" },
},
required: ["environment", "deployment_version"],
additionalProperties: false,
},
};
The thing is that, when I try to create different instances of this model under the same authenticateDID, I think I should receive the same StreamID, but I am getting different ones. Is this right?
For example in the following code, I should get the same streamIDs, right? Correct me if I am wrong:
const devDeploymentInstance = await modelInstanceClient.createInstance({
model: deploymentIdModelStreamId,
controller: authenticatedDID,
content: {
environment: "devDeploymentTest",
deployment_version: "v_",
},
shouldIndex: true,
});
const devDeploymentInstance2 = await modelInstanceClient.createInstance({
model: deploymentIdModelStreamId,
controller: authenticatedDID,
content: {
environment: "devDeploymentTest",
deployment_version: "v_",
},
shouldIndex: true,
});
await new Promise(resolve => setTimeout(resolve, 3000));
// To be used in
console.log("instance stream", devDeploymentInstance.baseID.toString());
console.log("instance 2 stream", devDeploymentInstance2.baseID.toString());
Thanks a lot! @mohsin
Also, another thing that i realize is that when I create an instance using accountRelation “set”, I am not able to get the document state (getDocumentState) from the instance, while using “list” works for me. Not sure if I am doing something wrong.