Skip to content

Error "Invalid sort() argument. Must be a string, object, or array" #139

@doantn1991

Description

@doantn1991

I have my source code below using coffeescript:
`personSchema = new mongoose.Schema({
name: String,
age: Number
})

Person = mongoose.model('Person', personSchema)

options = {
  sort: { age: -1 }
}

Person.findOne({}, null, options, (err, result) ->
  if err
    console.error('err:', err)
  else
    console.log('result:', result)
)`

Even though the sort value I am using is in the correct syntax for sort query. But every now and then I get the above error. Do you know the reason why?
Version coffee-script: 1.7.1
mongoose: 4.10.6
mquery: 2.3.3
mongodb: 2.2.34

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions