Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

Query $in doesn't works with _id #106

Closed
Buom01 opened this issue Jan 2, 2018 · 3 comments
Closed

Query $in doesn't works with _id #106

Buom01 opened this issue Jan 2, 2018 · 3 comments

Comments

@Buom01
Copy link

Buom01 commented Jan 2, 2018

Steps to reproduce

Make a query on the client:

app.service('users').find({
    _id: {
        $in: ["USER1_ID", "USER2_ID"]
    }
})

Or in REST : http://localhost:3030/users?_id[$in]=USER1_ID&_id[$in]=USER2_ID

With existing users ID;

Expected behavior

It should return users who are listed by their ID in $in property

Actual behavior

It return that no user match:
{"total":0,"limit":50,"skip":0,"data":[]}

Probably IDs should be converted anywhere

System configuration

MongoDB on linux 64 for the collection "users"

$ mongod --version
db version v3.6.1
git version: 025d4f4fe61efd1fb6f0005be20cb45a004093d1
OpenSSL version: OpenSSL 1.1.0g  2 Nov 2017
allocator: tcmalloc
modules: none
build environment:
    distarch: x86_64
    target_arch: x86_64

Module versions (especially the part that's not working) (On server):

$ npm list | grep mongo
├─┬ [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
$ npm list | grep feathers
├─┬ @feathersjs/[email protected]
│ ├── @feathersjs/[email protected]
│ ├── @feathersjs/[email protected] deduped
│ ├─┬ @feathersjs/[email protected]
│ │ ├── @feathersjs/[email protected] deduped
├─┬ @feathersjs/[email protected]
│ ├── @feathersjs/[email protected] deduped
├─┬ @feathersjs/[email protected]
│ ├── @feathersjs/[email protected] deduped
├─┬ @feathersjs/[email protected]
├─┬ @feathersjs/[email protected]
├─┬ @feathersjs/[email protected]
│ ├── @feathersjs/[email protected] deduped
│ ├── @feathersjs/[email protected] deduped
├─┬ @feathersjs/[email protected]
│ ├── @feathersjs/[email protected] deduped
├─┬ @feathersjs/[email protected]
│ ├── @feathersjs/[email protected] deduped
├─┬ [email protected]
│ ├─┬ [email protected]
├─┬ [email protected]
├─┬ [email protected] (git://github.com/feathers-plus/feathers-hooks-common.git#c99e4d51cbbf482f28137a574d61ef1b5a608363)
│ ├── @feathers-plus/[email protected]
│ ├── @feathersjs/[email protected] deduped
│ ├── @feathersjs/[email protected] deduped
├─┬ [email protected]
│ ├── [email protected] deduped
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └─┬ [email protected]
│ │ │   ├── [email protected] deduped
│ │ │   ├─┬ [email protected]
│ │ │   │ ├── [email protected]
│ │ │   │ ├─┬ [email protected]
│ │ │   │ │ ├── [email protected] deduped
├─┬ [email protected]
│ ├── @feathersjs/[email protected] deduped
│ ├── @feathersjs/[email protected] deduped

NodeJS version:
v8.9.3
Operating System:
Linux x64 (AntergOS (Based on ArchLinux))

@daffl
Copy link
Member

daffl commented Jan 2, 2018

See feathersjs/feathers#757

@Buom01
Copy link
Author

Buom01 commented Jan 2, 2018

Thank you

@Buom01 Buom01 closed this as completed Jan 2, 2018
@olaferlandsen
Copy link

See feathersjs/feathers#757

Hi @daffl, but I using mongoose and it still not work and the only option is create and using a hook before to convert plain object id(string) to ObjectId.

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

No branches or pull requests

3 participants