Stuck with an issue here.
I have 2 or more mongodb collections which need to be searched and the result of the search should be put into a JSON string.
// First collection
BasicDBObject dbo = new BasicDBObject();
dbo.append("transport", "car");
DBCursor cur = collectionOne.find(dbo);
// Second collection
BasicDBObject dbo = new BasicDBObject();
dbo.append("transport", "car");
DBCursor cur = collectionTwo.find(dbo);
The structure of the of the collection are not the same, but they do have a few common field, like 'transport','title', 'id' which are the fields that need to go in the json.
So combine the results of two searches into a single JSON response.
How would I do this?
Thanks for any help or suggestions!