MongoDB::__toString
MongoCollection::batchInsert
Core Classes
PHP Manual

# The MongoCollection class

## Wstęp

Representations a database collection.

Collection names can use any character in the ASCII set. Some valid collection names are "", "...", "my collection", and "*&#@".

User-defined collection names cannot contain the $ symbol. There are certain system collections which use a $ in their names (e.g., local.oplog.$main), but it is a reserved character. If you attempt to create and use a collection with a $ in the name, MongoDB will assert.

## Krótki opis klasy

MongoCollection
MongoCollection {
/* Fields */
public MongoDB $db = `NULL` ;
public integer $w ;
public integer $wtimeout ;
/* Metody */
public mixed batchInsert ( array `$a` [, array `$options` = array() ] )
public __construct ( MongoDB `$db` , string `$name` )
public int count ([ mixed `$query` = array() ] )
public array createDBRef ( array `$a` )
public array deleteIndex ( string|array `$keys` )
public array deleteIndexes ( void )
public array drop ( void )
public boolean ensureIndex ( array `$keys` , array `$options` )
public MongoCursor find ([ array `$query` = array() [, array `$fields` = array() ]] )
public array findOne ([ array `$query` = array() [, array `$fields` = array() ]] )
public MongoCollection __get ( string `$name` )
public array getDBRef ( array `$ref` )
public array getIndexInfo ( void )
public string getName ( void )
public array group ( mixed `$keys` , array `$initial` , MongoCode `$reduce` [, array `$condition` = array() ] )
public mixed insert ( array `$a` [, array `$options` = array() ] )
public mixed remove ( array `$criteria` [, array `$options` = array() ] )
public mixed save ( array `$a` [, array `$options` = array() ] )
public string __toString ( void )
public boolean update ( array `$criteria` , array `$newobj` [, array `$options` = array() ] )
public array validate ([ bool `$scan_data` = `FALSE` ] )
}

## Fields

db

  The "parent" database for this collection.

w

  The number of servers to replicate a change to before returning success. Value is inherited from the parent database. The MongoDB class has a more detailed description of how w works.

wtimeout

  The number of milliseconds to wait for $this->w replications to take place. Value is inherited from the parent database. The MongoDB class has a more detailed description of how wtimeout works.

## Zobacz też:

MongoDB core docs on » collections.

## Spis treści

- MongoCollection::batchInsert — Inserts multiple documents into this collection
- MongoCollection::__construct — Creates a new collection
- MongoCollection::count — Counts the number of documents in this collection
- MongoCollection::createDBRef — Creates a database reference
- MongoCollection::deleteIndex — Deletes an index from this collection
- MongoCollection::deleteIndexes — Delete all indices for this collection
- MongoCollection::drop — Drops this collection
- MongoCollection::ensureIndex — Creates an index on the given field(s), or does nothing if the index already exists
- MongoCollection::find — Querys this collection
- MongoCollection::findOne — Querys this collection, returning a single element
- MongoCollection::__get — Gets a collection
- MongoCollection::getDBRef — Fetches the document pointed to by a database reference
- MongoCollection::getIndexInfo — Returns an array of index names for this collection
- MongoCollection::getName — Returns this collection's name
- MongoCollection::group — Performs an operation similar to SQL's GROUP BY command
- MongoCollection::insert — Inserts an array into the collection
- MongoCollection::remove — Remove records from this collection
- MongoCollection::save — Saves an object to this collection
- MongoCollection::__toString — String representation of this collection
- MongoCollection::update — Update records based on a given criteria
- MongoCollection::validate — Validates this collection

MongoDB::__toString
MongoCollection::batchInsert
Core Classes
PHP Manual