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?
尝试: 'mongodb://localhost:27017/webIsoRogue'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.