Find multiple model objects by ids
See original GitHub issueHey Team,
Is there a way to find multiple model objects by ids?
await HotelModel.find({ id: { $in: ids } });
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Django get objects for many IDs - Stack Overflow
My current solution works, however it hammers the database with a a bunch of get queries inside a loop.
Read more >Making queries | Django documentation
Once you've created your data models, Django automatically gives you a database-abstraction API that lets you create, retrieve, update and delete objects.
Read more >Is it possible to do a multiple id request? - Google Groups
I'm working with backbone and backbone-relational and it would be nice if I could retrieve multiple models at once. I've read the docs...
Read more >Active Record Query Interface - Ruby on Rails Guides
The find method will raise an ActiveRecord::RecordNotFound exception if no matching record is found. You can also use this method to query for...
Read more >What's the most performant way to get multiple documents by ...
What's the most performant way to get multiple documents by an indexed field? ... (But with real object IDs and a whole lot...
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
After digging into the code, this way works for me.
@AV25242 above options not working me too also, please check.
@chendu can you try below query builder option,
const select_param = [{ $field: ‘id,name,status’ }]; let params = {where: {_type:‘hotel’,$in: { search_expr: ‘id’, target_expr: [ids-array] }} } let raw_query = new Query(params, bucketName).select(select_param).build(); let Hotels = await ottomanConnection.query(raw_query);