Open DaBlitzStein opened 10 years ago
I have had same problem (tried to POST
new data or PUT
changes via POSTMAN chrome extension). Make sure your header contains Content-Type: application/json
pair, other than that a JSON will not be processed. As I extended my header the sample worked as expected.
It doesn't work for me @adyba
Actually the system doesn't accept schemaless mongodb types:
var express = require('express'), restful = require('node-restful'), mongoose = restful.mongoose; var app = express();
app.use(express.bodyParser()); app.use(express.query());
mongoose.connect("mongodb://localhost:27017/schemalesstable");
var gameData = app.resource = restful.model('gameData', mongoose.Schema({ },{collection: 'gameData', strict:false})).methods(['get', 'post', 'put', 'delete']);
gameData.register(app, '/rest/gameData');
app.listen(4000);
The insertion only shows an empty document:
/* 0 */ { "_id" : ObjectId("53c862fc3e3f44ac29feee07"), "__v" : 0 }