$select doesn't work in find?
See original GitHub issue$select doesn’t work in find operation. I found that the source code for $select is not the same as that in other packages like feathers-mongodb
or feathers-nedb
. Normally the code would be like this:
// $select uses a specific find syntax, so it has to come first.
if (filters.$select) {
query = this.Model.find(params.query, getSelect(filters.$select));
}
but in feathers-mongoose
(via github) it is like:
// $select uses a specific find syntax, so it has to come first.
if (filters.$select && filters.$select.length) {
let fields = {};
for (let key of filters.$select) {
fields[key] = 1;
}
query.select(fields);
}
and furthermore, in the actually feathers-mongoose
npm package (v3.3.6) the source code is:
// $select uses a specific find syntax, so it has to come first.
if (filters.$select && filters.$select.length) {
var fields = {};
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = filters.$select[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var key = _step.value;
fields[key] = 1;
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
query.select(fields);
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
jQuery find not working for select="selected" - Stack Overflow
I tried $('#mySelector').find(":selected") . It returns [] . But if my options have only selected property instead of selected ...
Read more >"Find" is not working in excel - Microsoft Community
For the find functionality, select the Home ribbon and then the Find & Select (far right of the Home ribbon) and then select...
Read more >How to Fix When Excel Find Is Not Working
To fix this mistake, first click the Find All (or Find Next) button, and then press the Replace All (or Replace). excel find...
Read more >"Select All Occurrences of Find Match" doesn't work if ... - GitHub
It's a bug because "Select All Occurrences of Find Match" should have consistent behaviour; it shouldn't matter if you have the find panel...
Read more >Repair a storage device in Disk Utility on Mac - Apple Support
In the Disk Utility app on your Mac, choose View > Show All Devices. If Disk Utility isn't open, click the Launchpad icon...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just cloned
feathers-chat
project, changed it’s service from nedb to mongoose, and modify/public/react-chat/app.jsx
L128 to:other stuffs work perfectly including $sort, &skit and #limit, but $select seems to be ignored.
got it. Thanks~
来自 魅族 MX5
-------- 原始邮件 -------- 发件人:Marshall Thompson notifications@github.com 时间:周三 3月23日 16:10 收件人:feathersjs/feathers-mongoose feathers-mongoose@noreply.github.com 抄送:Beep LIN beeplin@gmail.com 主题:Re: [feathers-mongoose] $select doesn’t work in find? (#71)