Error "Invalid sort() argument. Must be a string, object, or array"
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- coffeescript, javascript, mongodb, nodejs
- Domain
- databases
Research direction
No file or test is named in the payload. Start by reproducing the intermittent failure with the shown findOne({}, null, { sort: { age: -1 } }) call, then locate where mquery validates the sort option and raises Invalid sort() argument. Done means a minimal reproduction, the rejecting code path identified, and a test covering the object-sort case.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- JavaScript
- Stars
- 485
- Forks
- 68
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mongoosejs/mquery
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
mongoosejs/mquery#142 · 1 comment ·
-
Typescript supportOpen
Difficulty 4/5 3-5 days Newbie friendliness 20/100
mongoosejs/mquery#119 · 2 comments · 3 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
mongoosejs/mquery#77 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
mongoosejs/mquery#36 ·
-
docs
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
mongoosejs/mquery#10 ·
All issues in mongoosejs/mquery
Similar issues
-
[ordering-review] workshop order graph: 1 confirmed ordering problem, 3 cycles are false positivesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
githubnext/gh-aw-workshop#5331 ·
Maintainers usually reply within 1 day
-
Remove: 21 SexturyOpenchannels:remove check:passed
Difficulty 1/5 Under an hour Newbie friendliness 65/100
Maintainers usually reply within 4 days
-
[vika] console keeps a stale "in progress" turn after a daemon restart mid-runPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
volcengine/OpenViking#7011 ·
Maintainers usually reply within 1 day
-
__VERSION__ within dist build is not replaced, causes missing version in XDM implementation detailsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Issue: ready for confirmation Reported on 2.4.9 Triage: Dev.Experience
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
magento/magento2#41773 · 1 comment ·
Maintainers usually reply within 5 days