Old | New | |
1 | 1 | |
---|
| 2 | = select() = |
---|
| 3 | ---- |
---|
| 4 | [[MongoDB Driver Function Reference]] |
---|
| 5 | |
---|
| 6 | |
---|
| 7 | Selects the fields specified into a result set. |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | [[[@cG |
---|
| 11 | |
---|
| 12 | <cursor>.select([<field>[,...]]) |
---|
| 13 | |
---|
| 14 | ]]] |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | **Arguments** |
---|
| 18 | |
---|
| 19 | [[[@w |
---|
| 20 | |
---|
| 21 | |@t0@r0@c0 <cursor> | | A result set. | |
---|
| 22 | | <field> | | A field name. | |
---|
| 23 | |
---|
| 24 | ]]] |
---|
| 25 | |
---|
| 26 | Field names may - but need not - be quoted. If asterisk is passed for fields or if fields are omitted, all fields will be selected. |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | **Returns** |
---|
| 30 | |
---|
| 31 | [[[@w |
---|
| 32 | |
---|
| 33 | Returns a result set (cursor). |
---|
| 34 | |
---|
| 35 | ]]] |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | **Example** |
---|
| 39 | |
---|
| 40 | [[[@cw |
---|
| 41 | |
---|
| 42 | db.employees.find().select("name", "firstname", "age"); |
---|
| 43 | |
---|
| 44 | ]]] |
---|
| 45 | |
---|
| 46 | Selects name, firstname and age fields from the //employees// collection. |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | ---- |
---|
| 51 | [[Main|home]] | [[MongoDB Driver Function Reference]] | [[MongoDB Driver]] |
---|
| 52 | |
---|