Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Mongoose Adapter Single Index support

  • Loading branch information...
commit 768ba2c677606403a948418f5b560fd694367c14 1 parent 4ce4a0b
@nashadalam nashadalam authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/adapters/mongoose.js
View
8 lib/adapters/mongoose.js
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.