Linked Questions
29 questions linked to/from $lookup multiple levels without $unwind?
3 votes
1 answer
1k views
$lookup multiple levels in mongodb
I'm new with mongodb and I have wrote query using mongoose populate. this.model.findById({ _id: req.params.id }) .populate('potentialLevels', 'description result plIndex') .populate({ path: '...
0 votes
2 answers
1k views
MongoDB $lookup on 2 level nested document without using $unwind
I have the following documents loanRequest (Writing just the keys that I want to project) { "_id": "5f2bf26783f65d33026ea592", "lendingpartner": { /* some keys ...
1 vote
1 answer
507 views
mongodb nested array element $lookup
I have two collections, orders and products. I like to join all the order.items[] to products collection to add more fields to the items[] Sample Data: orders [{ _id: 1, items: [ { product_id: 1, ...
0 votes
1 answer
335 views
can't sort in mongo/mongoose with populate
I can't seem to sort this mongo/mongoose query. The first one returns the exact results, just not sorted in the opposite direction. const UserSchema = new Schema({ username : String, ...
2 votes
1 answer
322 views
Get result from three collection in mongodb
I have three collection contain data as like bellow, Clients Collection { "_id" : ObjectId("5a058e316803fafd127b23c9"), "client_name" : "client A", "client_status" : "A" } { "_id"...
1 vote
0 answers
219 views
How to Join 2 Collection into 1 in Mongoose without Populate
so I have the task to combine 2 collections into 1 to be able to search by additional parameter queries like ac_key or ac_value, but the reality is not as expected, this only works for one collection,...
1 vote
1 answer
125 views
Mongodb aggregation lookup 2 level, created new entry of the result instead of just populating the column that have the objectId
I have already asked this question, but for some reason someone marked it as duplicate to this $lookup multiple levels without $unwind? and i don't understand why, my expected output is to directly ...
0 votes
1 answer
103 views
How to populate an array of model instances inside a subdocument? MongoDB Mongoose
I have a subdocument that is nested as an array. Inside that subdocument I have references to other models. Using the .Find and .Populate methods I can receive the entire objects for single models ...
0 votes
1 answer
79 views
Mongoose lookup fetching data from multi collection
When i combine 2 table to fetch data from mongoDB collection struck with my expected out. please any one help me to fix the same pleas. Collection: recipecatagories { "_id":{"$oid":"...
0 votes
1 answer
90 views
How to join 2 collections if the ID types in 1st collection is ObjectId and the foreign key type is string in mongodb
I have 2 collections,1st is: { "_id" : ObjectId("62eb5713ac2dccfb0a75d6c0"), "title" : "Agile Web Development with Rails", "...
1 vote
1 answer
67 views
$lookup multiple levels
Currently I have this query: Post.find().populate([ { path: 'page', populate: { path: 'url', populate: { path: 'i18n', ...
0 votes
0 answers
69 views
MongoDB aggregate lookup collections
I have two MongoDB collections which are joined like that var userSchema = new Schema({ username: String, location: {type: mongoose.Schema.Types.ObjectId, ref: 'Location' }, }); var ...
0 votes
0 answers
51 views
How can i optimise this query, $ememMatch taking a lot more time to execute
how can i make execution more faster, following query is taking 3.3 seconds to execute from 55,000 records, as per me the $elemMatch is taking more time, without that condition it executes in ...
0 votes
1 answer
40 views
How to get the relation information from 2 collections, nodejs and mongodb
I have 2 schemas (event, venue) Event Schema is as shown below: var mongoose = require('mongoose'); var bcrypt = require('bcryptjs'); var EventSchema = mongoose.Schema({ _id:mongoose.Schema.Types....