Skip to content

Commit

Permalink
fixed to only search string fields
Browse files Browse the repository at this point in the history
  • Loading branch information
nullivex committed Jan 9, 2014
1 parent 1b7629a commit b20eaf3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
8 changes: 8 additions & 0 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,11 @@ Uses a Mongoose style sort string eg: `+name -author'
* Default `''`

Filter results by value applying to the `searchFields`

## Changelog

### 0.1.1
* Fixed bug with searching on non string fields

### 0.1.0
* Initial Release
4 changes: 2 additions & 2 deletions lib/mongoose-list.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ module.exports = exports = function list(schema,options){
search.find.$or.push(obj)
})
} else {
Model.schema.eachPath(function(path){
if(0 !== path.indexOf('_')){
Model.schema.eachPath(function(path,type){
if(0 !== path.indexOf('_') && String === type.options.type){
var obj = {}
obj[path] = searchText
search.find.$or.push(obj)
Expand Down
2 changes: 1 addition & 1 deletion package.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mongoose-list",
"version": "0.1.0",
"version": "0.1.1",
"description": "List plugin for mongoose that allows pagination, filtering, and sorting.",
"homepage": "https://github.com/snailjs/mongoose-list",
"bugs": "https://github.com/snailjs/mongoose-list/issues",
Expand Down
15 changes: 15 additions & 0 deletions test/model.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,20 @@ exports.model = mongoose.model('Test',new mongoose.Schema({
name: {
type: String,
require: true
},
hits: {
type: Number,
require: false,
default: 10
},
foo: {
type: mongoose.Schema.Types.Mixed,
require: false,
default: 'fox'
},
dateCreated: {
type: Date,
require: false,
default: Date.now
}
}))
Empty file modified test/mongoose-list.test.js
100644 → 100755
Empty file.

0 comments on commit b20eaf3

Please sign in to comment.