[SERVER-27752] How to add field with static value to mongodb find query? Created: 19/Jan/17 Updated: 20/Jan/17 Resolved: 20/Jan/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Logging, Querying |
| Affects Version/s: | 3.2.9 |
| Fix Version/s: | None |
| Type: | Question | Priority: | Major - P3 |
| Reporter: | Sanjeev Kumar | Assignee: | Mark Agarunov |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
Can we add some custom field with static value to mongodb find query? I am trying to add/append API request UId to all the queries that we are making to mongodb, so that we can map requests with slow queries from mongodb logs. I am doing it in aggregate queries by using '$literal' in projected fields.
Also I can't include each field individually in projected fields and add the "custom_id" field with the static value. |
| Comments |
| Comment by Sanjeev Kumar [ 20/Jan/17 ] |
|
Hi, Thanks for the reply. Thanks, |
| Comment by Mark Agarunov [ 19/Jan/17 ] |
|
Hello sanjeev24, Thanks for your report. It seems that your goal is to add a value to all of your queries. If this is the case, the $comment operator, for which documentation can be found here, is likely the best way to accomplish this. Please note that SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag. A question like this involving more discussion would be best posted on the mongodb-user group. Thanks, |