zkDatabase icon indicating copy to clipboard operation
zkDatabase copied to clipboard

Handle data schema and store o1js Struct in MongoDB

Open chiro-hiro opened this issue 1 year ago • 0 comments

We may need to define a schema collection in each data that define the structure of o1js Struct to allow us to serialize/deserialize an o1js Struct from mongo Document. This is necessary for Merkle tree implementation.

Expectation:

{
  collection: string,
  schema: any,
  createdAt: Date,
  updatedAt: Date
}

collection is the collection name to store actual data and of course data need to satisfy the type validation of the schema.

E.g:

const User = Struct({age: Uint32, user: PublicKey});

Apparently age can't be a string, the schema was use to guarantee the consistent from both side.

chiro-hiro avatar Dec 27 '23 07:12 chiro-hiro