MongoDB findRaw doesn't seem to work
See original GitHub issueBug description
I can’t seem to use the MongoDB findRaw
command successfully. I can verify that findFirst
works though on the same client. For example…
// doesnt work
console.log(await client.user.findRaw({
filter: {
id: {$eq: '6M4D3ncvpAWy2Fo8T'}
}
}))
// does work
console.log(await client.user.findFirst({
where: {
id: '6M4D3ncvpAWy2Fo8T'
}
}))
Note: I don’t think its related to how the IDs are defined. if i include another basic string field and try to query on that it still doesnt work. Nor a basic Int field.
How to reproduce
- Generate a client with the above schema. (Note that our IDs do not use ObjectIds but instead are just unique strings)
- Try the console.log statements above
Expected behavior
I expect at least one record to be found.
Prisma information
my schema is very basic:
generator client {
provider = "prisma-client-js"
output = "./generated/mongo-db"
previewFeatures = ["mongoDb"]
}
datasource db {
provider = "mongodb"
url = env("MONGO_DATABASE_URL")
}
model User {
id String @unique @id @map("_id")
@@map("users")
}
Environment & setup
- OS: PopOS
- Database: MongoDB
- Node.js version: 16.13.2
Prisma Version
prisma : 3.10.0
@prisma/client : 3.10.0
Current platform : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine : migration-engine-cli 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary : prisma-fmt 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash : 73e60b76d394f8d37d8ebd1f8918c79029f0db86
Studio : 0.458.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Mongoose near maxDistance doesn't seem to have an effect
I'm trying to write a simple query in Mongoose that returns a number of nearby results that all have GeoJSON properties. However, I'm...
Read more >UnmarshalBSON having different behavior than ... - MongoDB
Hi there, I am trying to work with an interface{} I have an object ... for the interface, doesn't seem to be set,...
Read more >find — MongoDB Manual
Changed in version 4.4: MongoDB deprecates the oplogReplay option to the find command. The optimization enabled by this flag in previous versions now...
Read more >Building a BSON filter from raw query string - MongoDB
I'm using the mongocxx driver and want to use some tested queries from the mongo shell instead of building them inconveniently with the...
Read more >WMS 2.0 corrupted MongoDB - Wyse Management Suite - Dell
I'm looking at the logs in MongoDB and it seems to be that the database ... calculated block checksum doesn't match expected checksum...
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
Hey @stringbeans, since ids are represented with
ObjectId
s or$oid
on the db level, you need to build your query like the following:@janpio yes thats correct! even if i try searching by other fields (ie. not the
id
field) i still cannot get results back…@matthewmueller yes! we are working with the collections created by the MeteorJS framework. we’re relatively inexperienced with that framework, but from what i understand, MeteorJS does not use ObjectIDs for their id fields but instead uses an internal package
meteor/random
to generate the ids. its something to do with how they manage optimistic UI changes… this forum post touches on it: https://forums.meteor.com/t/using-mongos-random-ids-instead-of-meteors/17184/10