Updating column using agreegate

i have a table which is ward table, and another table which is levels.
for wards table, there is column with currentLevel which is associated to Id on levels table.
image . This is wards table.

and this is levels table
. Looking at this screenshots, if level id is associated with any ward, that ward is automatically in that class e.g basic 1, Basic 2 and so on.

so i want to promote all the ward in that particular class (from basic 1 to basic 2) automatically using another currentLevel (id) which will be promoted to another class i.e from currentLevel (id) (basic 1) to currentLevel(id) basic 2. Please help me. its urgent

Hey @Gbade_Francis,

Can you please explain this a bit more:

As per my understanding, you have references using ObjectID( which is currentLevel) in the wards collection that would not match the ObjectIDs in levels (type mismatch). It would be good to fix this type mismatch and then you can try to do an approach like this:

		// _id for a level with name "basic 1"
		currentLevel: ObjectId(...)
		$set: {
			// _id for a level with name "basic 2"
			currentLevel: ObjectId(...)

If this isn’t the case, provide sample documents in text format instead of screenshots along with the output you are expecting in order for us to better understand the problem statement. :smile: