brikteknologier / seraph-model

thin model layer for seraph/neo4j (node.js)
MIT License
111 stars 28 forks source link

Seraph DB created with thunkify: true doesn't work with seraph-model #97

Closed vinerz closed 8 years ago

vinerz commented 9 years ago

Hello! Seraph instances created with thunkify option set to true doesn't have a nice conversation with seraph-model, which hangs on model.save and other actions, maybe because it relies on callbacks instead of thunks.

This workaround works for now:

let neo4j = require('seraph')({
    thunkify: true,
    server: config.neo4j.host,
    user: config.neo4j.credentials.username,
    pass: config.neo4j.credentials.password
});

neo4j._regular = require('seraph')({
    server: config.neo4j.host,
    user: config.neo4j.credentials.username,
    pass: config.neo4j.credentials.password
});

let Profile = require('seraph-model')(neo4j._regular, 'Profile');
jonpacker commented 8 years ago

No, you're right, I wouldn't expect it to. The thunkify option was experimental, which is why it's undocumented, and seraph-model relies on a non-thunkified instance of seraph to work. Thanks for documenting the workaround so people can find it here, though!