balderdashy / balderdashy/sails

Waterline, sum() mongodb adapter -> The 'cursor' option is required.

Open
#6,795 5 comments 0 reactions 0 assignees View on GitHub
helpful info or workaround mongo orm
Dominant language
JavaScript
Stars
22.8k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Sails@lastest-version
Node@stable-version

my action:

```
module.exports = {
friendlyName: 'Total',

description: 'Total finance.',

inputs: {
project: {
type: 'string',
required: true
}
},

exits: {},

fn: async function({ project }, exits) {
const listTotalFinances = await Finance.sum('value').where({
project
});
if (listTotalFinances) {
return exits.success(listTotalFinances);
}
}
};

```
Error info:

```
Sending 500 ("Server Error") response:
AdapterError: Unexpected error from database adapter: The 'cursor' option is required, except for aggregate with the explain argument
at Object.fn..
```

Im using MongoDB Atlas.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the shown Finance.sum('value').where({ project }) action against MongoDB Atlas and inspect the MongoDB adapter path handling the aggregate query. Compare the cursor error with the expected sum result; done means the query completes without AdapterError and returns the total.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, node.js
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.