[SERVER-1696] Provide ability to query for the existence of a Document without needing to return anything about the object. Created: 27/Aug/10 Updated: 17/Mar/11 Resolved: 31/Aug/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 1.6.1 |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Andre' Hazelwood | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
In order to test for the existence of an object, a find(template).count() > 0 can be used to determine if a Document matching the template currently exists. However, this is work that doesn't need to be done. Instead, it would be nice if a call like: find(template).exists() or exists(template) could be used. In this case a simple boolean true/false return value would be sufficient. |
| Comments |
| Comment by Eliot Horowitz (Inactive) [ 31/Aug/10 ] |
|
db.foo.findOne( { query }, { _id : 1 } ) |