dbms
dbms copied to clipboard
MongoDB builder.join is not working
I've tried with mongodb version 3.6.14 and 4.2.0, join is not working.
What I have tried
// Select all with join ver.1 FAILED
db.find('data_user').make(function(builder){
builder.join('id','data_user_profile')
.on('id','id')
.callback((err,response,count) => {
console.log(response);
});
});
// Select all with join ver.2 FAILED
var user = db.find('data_user');
var profile = user.join('id','data_user_profile')
.on('id','id')
.callback((err,response,count) => {
console.log(response);
});
Error info is same like this:
======= 2019-09-11 11:30:49: TypeError: client.$dbms._join is not a function TypeError: client.$dbms._join is not a function
at /home/aziz/Work/nodejs/total-mongodb/node_modules/dbms/mongo.js:52:17
at result (/home/aziz/Work/nodejs/total-mongodb/node_modules/mongodb/lib/operations/execute_operation.js:75:17)
at executeCallback (/home/aziz/Work/nodejs/total-mongodb/node_modules/mongodb/lib/operations/execute_operation.js:68:9)
at handleCallback (/home/aziz/Work/nodejs/total-mongodb/node_modules/mongodb/lib/utils.js:129:55)
at cursor.close (/home/aziz/Work/nodejs/total-mongodb/node_modules/mongodb/lib/operations/to_array.js:36:13)
at handleCallback (/home/aziz/Work/nodejs/total-mongodb/node_modules/mongodb/lib/utils.js:129:55)
at completeClose (/home/aziz/Work/nodejs/total-mongodb/node_modules/mongodb/lib/cursor.js:859:16)
at Cursor.close (/home/aziz/Work/nodejs/total-mongodb/node_modules/mongodb/lib/cursor.js:878:12)
at cursor._next (/home/aziz/Work/nodejs/total-mongodb/node_modules/mongodb/lib/operations/to_array.js:35:25)
at handleCallback (/home/aziz/Work/nodejs/total-mongodb/node_modules/mongodb/lib/core/cursor.js:32:5)
Note:
- I make test join in same database.
- data_user is in mongodb.
- data_user_profile is also in same mongodb.
- For mongodb version 4, there is DeprecationWarning, but I know if mongodb driver is not update yet.