Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The definition function for the plugin mongo-store has failed: Cannot read property 'init' of undefined #47

Open
ghter123 opened this issue Mar 2, 2019 · 2 comments

Comments

@ghter123
Copy link

ghter123 commented Mar 2, 2019

const seneca = require('seneca')();
const productPlugin = require('./plugins/product');
seneca.use(productPlugin);
seneca.use('mongo-store', { uri: 'mongodb://120.0.0.1:27017/test' })
seneca.ready((err) => {
    seneca.act({ area: 'product', action: 'add', category: 'food', name: '方便面' }, (err, result) => {
        console.log(result);
    });
});

When i use the plugin 'mongo-store'.The console write a fetal log 'The definition function for the plugin mongo-store has failed: Cannot read property 'init' of undefined'.
I try to find the reason.So i Debug the file mongo-store.js.

// the code in the file 374 row.
// error: seneca.store is undefined.
var meta = seneca.store.init(seneca, opts, store)

I think the reason is seneca missing some api. So ceate the issues.

@Omar-Trigui
Copy link

did you found any solution on this ?

@lilsweetcaligula
Copy link
Collaborator

lilsweetcaligula commented Jun 11, 2021

@Omar-Trigui
Please try "using" Seneca Entity before "using" the Mongo store:

const seneca = Seneca()

seneca
  .use('entity')
  .use('mongo-store', mongo_opts)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants