Required properties not actually required?

2 views
Skip to first unread message

Jay Young

unread,
Sep 11, 2010, 11:18:00 PM9/11/10
to appenginejs
I have a simple db.Model with just a few simple properites. One of
them is flagged with {required: true}, but if I create an instance and
put() it, no error is thrown and the entity appears in the datastore
without the required property:

var Response = require('nitro/response').Response;
var db = require('google/appengine/ext/db');

exports.GET = function(req) {
var TestModel = db.Model('TestModel', {
modelID: new db.StringProperty({required: true}),
modelName: new db.StringProperty({required: true})
});

var test = new TestModel();
test.put();

return Response.ok();
};

Running this throws no error and puts the entity into the data store.
Is that working correctly? If it is, how do I enforce that a property
be required?

Thanks.
Reply all
Reply to author
Forward
0 new messages