jerni
a framework to build data-driven products from the ground up

module: @jerni/store-mongo/Model

DataModel subclass with specific MongoDB operations

Summary

type: Class<MongoDBReadModel>

Usages

// DataModel subclass with specific MongoDB operations
const Model = require("@jerni/store-mongo/Model");
const userModel = new Model({
name: "users",
version: "1",
transform(event) {
if (event.type === "USER_REGISTERED") {
return {
insertOne: {
id: event.payload.id,
username: event.payload.username,
},
},
},
},
});