Aggregate.prototype.replaceRoot()
Parameters
- the «String|Object» field or document which will become the new root document
Returns:
- «Aggregate»
Appends a new $replaceRoot operator to this aggregate pipeline.
Note that the $replaceRoot
operator requires field strings to start with ‘$’. If you are passing in a string Mongoose will prepend ‘$’ if the specified field doesn’t start ‘$’. If you are passing in an object the strings in your expression will not be altered.
Examples:
aggregate.replaceRoot("user");
aggregate.replaceRoot({ x: { $concat: ['$this', '$that'] } });
当前内容版权归 mongoosejs 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 mongoosejs .