2

I have a springboot project which has mongoDB as the database. I have multiple collections in my MongoDB. Each category has its own collection similar to following.

Category_A
{ _id: 101, firstName: "Emma", surname: "Jackson", city: "Manchester"}
{ _id: 102, firstName: "Jane", surname: "Reynolds", city: "York"}

Category_B
{ _id: 201, firstName: "Julia", surname: "Jacob", city: "York"}
{ _id: 202, firstName: "Eric", surname: "Philips", city: "Bristol"}

Category_C
{ _id: 301, firstName: "Annie", surname: "Jones", city: "York"}
{ _id: 302, firstName: "Ryan", surname: "Lewis", city: "Bristol"}

I have to query all the collections to find the people from York and put them in a view to perform limit and skip on the view to support pagination.

I am not sure how to perform the union of query results from each collection into a single view. Is limit and skip applicable for view?

BlueStar
  • 401
  • 3
  • 9
  • 29

0 Answers0