DocumentReferences testing can fail if field is boolean #94

Open
eutheria opened this Issue Nov 14, 2012 · 0 comments

Projects

None yet

1 participant

@eutheria

When using DocumentReferences the generated view tests for a boolean field to determine the document type

for example:

@TypeDiscriminator
private Boolean moduleEnabled;
private String moduleParent;

@DocumentReferences(fetch = FetchType.LAZY, descendingSortOrder = true, orderBy = "_id", backReference = "moduleParent")
    private Set modules;

with

@GenerateView
    public List findByModuleParent(String moduleParent) {
        return queryView("by_moduleParent", moduleParent);
    }


this generated:

function(doc) { if(doc.moduleEnabled && doc.moduleParent) { emit([doc.moduleParent, 'modules', doc._id], null); } }

this test fails with doc.moduleEnabled set to false, I believe it would be a good idea if a custom document validator could be set?

Thanks for such a good library!

Francis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment