scottwrobinson / camo

A class-based ES6 ODM for Mongo-like databases.
556 stars 80 forks source link

Cannot `loadMany` on EmbeddedDocuments #44

Closed theworkflow closed 8 years ago

theworkflow commented 8 years ago

I've been currently been running into problems with embedded documents when trying to execute the loadMany function on one of my models. I have my class that's an embedded document and another class based off the class from the embedded document

class myMainClass extends EmbeddedDocument { ... }
class subClass extends myMainClass { ... }

myMainClass.loadMany(query, fn)

This is how I currently have the code implemented, but myMainClass does not have the loadMany function. Am I doing something wrong or is there currently not a function in the EmbeddedDocument class?

michaeljota commented 8 years ago

EmbeddedDocument are mean to be include inside a document. They have no index, and functions that you would expect form a document.

You need to use the 'subClass' in a class extending Document, and query in that class.

theworkflow commented 8 years ago

Shame on me. I figured that out right before I read your response. Thanks for clearing that up!

michaeljota commented 8 years ago

:+1: