1

I have been kidding around with Derby now for a while and am currently trying to wrap my head around the whole racer storage thing. Although I like the idea of not having any MongoDB queries hardcoded on the clientside, I can't quite get the whole thing to work.

I repeatedly get Error: No persistence handler for set(meta,[object Object],1) messages and have now attempted to boil it down to a minimal example. This is the relevant part of my server/index.js:

var http = require('http')
  , path = require('path')
  , express = require('express')
  , gzippo = require('gzippo')
  , derby = require('derby')
  , api = require('../api')
  , app = require('../app')
  , serverError = require('./serverError')


// SERVER CONFIGURATION //

var expressApp = express();
var server = module.exports = http.createServer(expressApp);

derby.use(derby.logPlugin);


// Setting up MongoDB storage
derby.use(require('racer-db-mongo'));
var store = derby.createStore({
  listen:  server
  , db: {
      type: 'Mongo'
    , uri: 'mongodb://localhost/webIsoRogue'
  }
});

// Trying to insert some dummy data
var model = store.createModel();
model.set('meta', {
  app: {
    title: 'Hi there'
  , author: 'Erik Mathers'
  }
});

console.log(model.get('meta.app'));

I have verified multiple times that the MongoDB server is running and accessible, it is!

As soon as I try to store the the dummy data I get the not quite helpful error message: Error: No persistence handler for set(meta,[object Object],1).

Can anybody tell me where I am going wrong?

Marcus Riemer
  • 7,244
  • 8
  • 51
  • 76

1 Answers1

0

Try: 'mongodb://localhost:27017/webIsoRogue'

Vladimir Makhaev
  • 1,104
  • 2
  • 10
  • 23