PHP » GoLang |
login |
register |
about
|
GoLang MongoCollection::save
request it (311)
GoLang replacement for PHP's MongoCollection::save
[edit | history]
MongoCollection::save(PECL mongo >=0.9.0) MongoCollection::save — Saves a document to this collection DescriptionIf the object is from the database, update the existing database object, otherwise insert this object. Parameters
Return Values
If Errors/ExceptionsThrows MongoException if the inserted document is empty or if it contains zero-length keys. Attempting to insert an object with protected and private properties will cause a zero-length key error. Throws MongoCursorException if the "w" option is set and the write fails. Throws MongoCursorTimeoutException if the "w" option is set to a value greater than one and the operation takes longer than MongoCursor::$timeout milliseconds to complete. This does not kill the operation on the server, it is a client-side timeout. The operation in MongoCollection::$wtimeout is milliseconds. Changelog
ExamplesExample #1 MongoCollection::save() example
<?php The above example will output something similar to: array(2) { ["x"]=> int(1) ["_id"]=> object(MongoId)#4 (1) { ["$id"]=> string(24) "50b6afe544415ed606000000" } } |
more
Recently updated
more
Most requested
more
Last requests
|