Q1
In MEAN Stack, how do you prevent double CORS preflight issues when Angular sends JWT Authorization headers to Express?
Ensure Express enables cors() with explicit allowedHeaders: ['Content-Type', 'Authorization'] and responds 204 immediately to OPTIONS preflight requests before auth middleware rejects unauthenticated headers.
Q2
Why does angular-cli proxy (proxy.conf.json) work in ng serve dev mode yet break after building dist/ onto Node?
proxy.conf.json belongs strictly to the webpack dev server. In production, either serve Angular static assets behind Nginx/Express on the same origin or point Angular environment.prod.ts to the full HTTPS API domain.
Q3
How do Angular HttpInterceptor + Express Refresh Token cookies coordinate seamlessly when concurrent API calls receive 401?
Without coordination, 5 parallel dashboard calls getting 401 fire 5 simultaneous refresh calls. Queue concurrent failed requests behind a single shared BehaviorSubject refresh lock so refresh runs once and replays all 5 cleanly.
Q4
Why should MongoDB aggregation $match always appear BEFORE $lookup and $unwind in Express analytics endpoints?
Filtering early ($match) utilizes collection indexes and shrinks intermediate document counts drastically before memory-heavy joins ($lookup) and array expansion ($unwind) execute.
Q5
What breaks when Angular Reactive Forms send optional empty string '' fields into Mongoose schemas expecting Number or enum?
Empty HTML inputs submit '' instead of undefined, failing Mongoose casting or enum validators. Normalize empty strings in form submission DTOs or Mongoose pre-validate middleware.
Q6
Why does deep-linking /dashboard/orders/42 return 404 when Angular static assets are served by Express without a catch-all?
Browser refreshes send /dashboard/orders/42 to the Express server rather than Angular's client router. Add an Express fallback (app.get('*', ...) after /api/* routes) returning index.html.
Q7
How does Mongoose select: false on password fields interact with findOne() during Express login?
Setting select: false protects passwords across normal GET endpoints automatically. During login only, explicitly append .select('+password') so bcrypt.compare() can verify credentials.
Q8
Why is express.json({ limit: '10kb' }) important in production MEAN APIs?
Unbounded JSON body parsing allows attackers to send multi-megabyte payloads that freeze Node's single-threaded parser or crash heap memory.
Q9
What causes MongoDB 16MB BSON document size crashes in social or order MEAN apps?
Embedding unbounded growing arrays (e.g. comments, logs, click events) inside a single document eventually hits MongoDB's hard 16MB limit. Model unbounded relations in separate referenced collections.
Q10
Why should RxJS errors inside Angular services be caught inside inner pipe(catchError(...)) rather than only top-level streams?
An unhandled error terminates the parent Observable stream permanently (breaking button clicks/search streams). Catching errors inside the inner switchMap(() => http.pipe(catchError(...))) keeps the outer UI stream alive.