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

Already on GitHub? Sign in to your account

Mongoose Adapter Single Index support #125

Merged
merged 2 commits into from Sep 26, 2012
Jump to file or symbol
Failed to load files and symbols.
+6 −2
Split
View
@@ -48,8 +48,12 @@ function MongooseAdapter(client) {
MongooseAdapter.prototype.define = function (descr) {
var props = {};
Object.keys(descr.properties).forEach(function (key) {
- props[key] = descr.properties[key].type;
- if (props[key].name === 'Text' || props[key].name === 'JSON') props[key] = String;
+ props[key] = {};
+ props[key].type = descr.properties[key].type;
+ if (props[key].type.name === 'Text' || props[key].type.name === 'JSON') props[key].type = String;
+ if (descr.properties[key].index) {
+ props[key].index = descr.properties[key].index;
+ }
});
var schema = new mongoose.Schema(props);
this._models[descr.model.modelName] = mongoose.model(descr.model.modelName, schema);