As I'm coding a Vue app using Firestore, I'm feeling the need for an ODM in the vein of Mongoid.
I could see something like:
// src/store/models/todo.js
import Vue from 'vue';
import documentMixin from '../documentMixin';
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 could operate on a todo object ie let todo = Todo.create(...); todo.updateAttribute(...); todo.upsert(...); todo.delete(); todo.text; todo.subTasks; todo.subTasks.create(...);
like in Mongoid. I actually have a very rough version of this that works using Vuex dynamic modules.
Anybody know of such libraries? I could see that something would not exist yet for Vue/firestore as firestore is still in beta. But I'm wondering if their is a flaw in my thinking that an ODM is needed here because my searches do not find any libraries for Vue/firebase.