last day (16 days later) » 

7:20 AM
Hello
 
sir i solved that issue
thanks sir
 
you are welcome
 
ok sir
can i close chat sir
 
are you done ?
 
yes sir
 
7:22 AM
oh okay
Do you know how to create a chat room ?
 
i don kno sir
 
You can always create a chat room and invite me
 
how to do that sir
 
8
Q: How do I chat with another user on StackOverflow?

marciokokoSometimes i find old posts and Id like to call a users attention to something new or just ask for a followup. How can I invite a user to chat? Ive clicked on the chat link and I can create a room but Im unable to invite a particular user.

save that link
 
ok sir
i need help in this
i have 60 k records
 
7:24 AM
next time when you create a chat room and add me it will automatically send me invite
 
ok sir
0
Q: How can i combine multiple collection into one collection using node.js ,mngodb?

its mei have 4 collections like division, category, productgroup, product these all are my data's which is stored in collection my division collecion data's { "divisionid": "1", "divisioncode": "0", "divisionname": "ELECTRONICS/HOME APPLIANCE", "divisionpoint": "2" }, { "d...

 
I'll try
what is the problem ?
 
its taking time and its not creating loading loading
 
do you need to load all the data at once ?
 
yes
i need to combine 4 collection and i should get summary collection like this
{

"product": {
"point": "1",
"name": "UNIVERSAL AC DC ADAPTER-PCS",
"code": "10000054",
"id" :"1"
},
"group": {
"point": "7",
"name": "ADAPTOR",
"id" :"1"
},
"category": {
"point": "0",
"name": "AUDIO SYSTEM",
"id" :"1"
},
"division": {
"point": "2",
"name": "ELECTRONICS/HOME APPLIANCE",
"id" :"1"
}
}
sorry like this
{
"_id" : ObjectId("58f70865214138efe11f7dbc"),
"productid" : 1,
"productcode" : 100054,
"productname" : "UNIVERSAL AC DC ADAPTER-PCS",
"productpoint" : "NULL",
"group" : {
"_id" : ObjectId("58f7083d214138efe11f7842"),
"productgroupid" : 1,
"divisionid" : 1,
"categoryid" : 1,
"productgroupcode" : 766,
"productgroupname" : "ADAPTOR",
"productgroupdesc" : "ADAPTOR",
"productgrouppoint" : "NULL",
"adddate" : "2014-08-15 19:25:24",
"updatedate" : "NULL"
},
"category" : {
"_id" : ObjectId("58f707ed214138efe11f7749"),
 
7:31 AM
what kind of application do you have ?
are you showing 60k records to the user ?
you should go ahead and create a new question with all the details. You will need a way to limit the no of records in aggregation pipeline
 
7:48 AM
okay leave me a message. I'll get back to you.
 
8:02 AM
i need to create one mmore question??
 
 
2 hours later…
10:21 AM
please if you can
this is not straightforward. You'll need to change your schema and find a way to limit the rows. 60k is not too much data but it doesnt make sense to pull them at once when you have to join 4 collections.
you can try allowDiskUse:true as aggregation option for now
and see if that helps you
 
 
2 hours later…
12:09 PM
0
Q: How can i combine multiple collection into one collection using with $lookup mongodb

its mei have below collections with document count division - 30, category - 248 productgroup - 1402 product - 60000 for example i given below data division { "divisionid": "1", "divisioncode": "0", "divisionname": "ELECTRONICS/HOME APPLIANCE", "divisionpoint": "2" }, { "div...

help me out sir
 
hi
I'll take a look
but you have to answer my question first to help you better
and please dont post your comment under other answer. Please create a chat room and invite me
 
i cant create new chat room
 
no need now
we can use this for time being
oh
 
ok sir
 
because of your reputation ?
points
sorry I didn't know that. Are you trying to learn mongodb ?
I see you are using robomongo to fetch results
 
12:16 PM
yeah
 
Can you explain why are you fetching 60k please ?
what are you going to do after fetching 60 k records ?
 
for my project requirement im doing this
 
what is requirement ? I'm just trying to understand what is the reason behind this
Why are you using robomongo ?
that is just a view client
 
then which one ineed to use
i m working on mongodb oly
they asked me to do this
 
so they asked to load all the data and do what ?
 
12:27 PM
they asked me to combine those data's
 
and store in some other collection ?
 
yes
sir is it possible to do with mongodb ??
 
do you use node js ?
 
yes
 
You'll have to stream the aggregation results and then use batch inserts to write to the new collection.
 
12:37 PM
how to do that help out sir
 
you've to try sir
I dont have that kind of time. I can always give you suggestion
 
actually i ' m beginner
 
you try and come back and I'll be happy to guide you
its okay
do you have link to docs ?
 
what i need do
means ?
 
12:40 PM
oksir
 
make sure to use aggregation cursor option
 
ok sir
 
try and msg me back
I'll be happy to help you
 
ok sir sure
 
 
1 hour later…
1:50 PM
sir i did not understand how to do aggregation and cursor
can you help me out sir
i did not understand the concept
 
 
1 hour later…
3:15 PM
sure which part you didnt understand ?
 
i have different collection
how can i combine ??
 
you are using $lookup for that right ?
 
where i need to write this lookup ??menas in which controller ?
 
I'm not really familiar with controllers here, whichever is your main controller
 
products
 
3:22 PM
are you following some tutorial ?
 
nop sir
 
find a good tutorial and try to use it for your problem
this is good tutorial for node js
 
now i tried to get all collection n product controller
'use strict';

var _ = require('lodash');
var Product = require('./product.model');
var Productcategory = require('../productcategory/productcategory.model');
var Productdivision = require('../productdivision/productdivision.model');
var Productgroup = require('../productgroup/productgroup.model');
var Productpointallocation = require('../productpointallocation/productpointallocation.model');

// Get all features group
exports.count = function(req, res) {

};
 
okay let me take a look
I would just do it one js class for now
just to make it all work
and later I can breakdown into models
 
3:38 PM
ok sir
 
3:53 PM
Here you go
sir
small program for you
var MongoClient = require('mongodb').MongoClient
, assert = require('assert');

var url = 'mongodb://localhost:27017/test';

MongoClient.connect(url, function(err, db) {
assert.equal(null, err);
console.log("Connected correctly to server");

var bulk = db.collection('productsummary').initializeUnorderedBulkOp();
var batch = 500;
var counter = 0;
var product = db.collection('product');

var cursor =product.aggregate([
{$lookup:{from:"productgroup", localField:"productgroupid", foreignField:"productgroupid", as:"group"}},
try to run and see if it hepls
adjust the collection name singular vs plural
and also the database name
try and leave a message here. I'll get back to you.
 
sir i have project
u ther sir
this is my exact controller name s
'use strict';

var _ = require('lodash');
var Product = require('./product.model');
var Productcategory = require('../productcategory/productcategory.model');
var Productdivision = require('../productdivision/productdivision.model');
var Productgroup = require('../productgroup/productgroup.model');
var Productpointallocation = require('../productpointallocation/productpointallocation.model');

// Get all features group
exports.count = function(req, res) {

};
 
4:38 PM
yes
how can I help you ?
I'm not sure what you are expecting from me
sir I recommended you to try the code I send first
and we can work together to change it to the project that you've
we need to verify if your data loading problem is fixed
firs
 
5:23 PM
sorry sir
for late reply
'use strict';

var _ = require('lodash');
var Product = require('./product.model');
var Productcategory = require('../productcategory/productcategory.model');
var Productdivision = require('../productdivision/productdivision.model');
var Productgroup = require('../productgroup/productgroup.model');
var Productpointallocation = require('../productpointallocation/productpointallocation.model');

// Get all features group
exports.count = function(req, res) {

var bulk = db.collection('Productpointallocation').initializeUnorderedBulkOp();
i am getting error
ReferenceError: db is not defined
'use strict';

var _ = require('lodash');
var Product = require('./product.model');
var Productcategory = require('../productcategory/productcategory.model');
var Productdivision = require('../productdivision/productdivision.model');
var Productgroup = require('../productgroup/productgroup.model');
var Productpointallocation = require('../productpointallocation/productpointallocation.model');

// Get all features group
exports.count = function(req, res) {

var bulk = Productpointallocation.initializeUnorderedBulkOp();
i am getting error
Productpointallocation.initializeUnorderedBulkOp is not a function
 
6:34 PM
np
Can you copy the code to a new js file ?
and run it using node
js
 
6:53 PM
may be you can try robo mongo
not sure if it is going to run from there
 
7:44 PM
let me know sir if you are stuck somewhere
 

  last day (16 days later) »