Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
doantn1991 opened this issue Jun 1, 2023 · 0 comments
Open

Comments

@doantn1991
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant