Automattic / Automattic/mongoose

Custom query helpers on embedded schemas

Open
#6,568 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
27.5k
Forks
4k
Avg merge
2d 7h
Merged PRs (30d)
35

Description

**Do you want to request a *feature* or report a *bug*?**
Feature

**What is the current behavior?**
Query helpers defined on schemas which are embedded into other schemas are not transferred to the parent schema.

**If the current behavior is a bug, please provide the steps to reproduce.**

https://gist.github.com/LK/3375e8199fccc22b70817842b1a570ef

**What is the expected behavior?**
The query helper from the embedded document is inherited into the parent schema.

**Please mention your node.js, mongoose and MongoDB version.**
Node: 9.5.0
Mongoose: 5.1.4
MongoDB: 3.4.2

Contributor guide

Open the contributing guide

Research direction

Start with the linked reproduction gist and trace how query helpers are registered on an embedded schema and exposed through the parent schema. Confirm the expected inheritance behavior against the reported Node, Mongoose, and MongoDB versions; done means the embedded helper is available when querying through the parent schema and the reproduction succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, node.js
Domain
backend, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.