Skip to content
This repository was archived by the owner on Apr 19, 2019. It is now read-only.
This repository was archived by the owner on Apr 19, 2019. It is now read-only.

Feature: Support of Object Data Mapper (ODM) #175

@bdiz

Description

@bdiz

Hello, this is somewhat related to my earlier comments in #167. What I've come to learn is that what I was looking for in my app is an ODM layer on top of Vuex, Firestore, vuexfire. Inspired by Mongoid, something like:

// src/store/models/todo.js
import Vue from 'vue';
import { documentMixin } from 'vuexfire';
import SubTask from './sub-task';

export default Vue.extend({
  mixins: [
    documentMixin('todo', {
      fields: ['text'],
      embeddedIn: 'category',
      embedsMany: { // uses firestore subcollection
        subTasks: { model: SubTask }
      }
    })
  ],
  computed: {
    // ...
  }
});

With this you can operate on a todo object ie let todo = Todo.create(...); todo.updateAttribute(...); todo.upsert(...); todo.delete(); todo.category; todo.text; todo.subTasks; todo.subTasks.create(...);.

I've built a working version of this using dynamic modules under the hood, but it needs a lot of work. Before I spend more time on it I thought I'd ask if this was on the road map of vuexfire? Or if there are other libraries you may know about that might just require a vuexfire "adapter" to get working? If their is no such ODM for even firebase, which has been around for a while, is there a flaw in my reasoning as to this being a missing level of abstraction for our Vuex/Firestore apps?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions