Skip to content

Instantly share code, notes, and snippets.

@tecbot
Created April 15, 2011 20:43
Show Gist options
  • Save tecbot/922450 to your computer and use it in GitHub Desktop.
Save tecbot/922450 to your computer and use it in GitHub Desktop.
mondodb-odm querys
EmbedMany - Querys when updated a Collection
1. Delete Collection
"array(1) {
["delete"]=>
array(1) {
["$unset"]=>
array(1) {
["mRs"]=>
bool(true)
}
}
}
2. Insert New Rows
Why all in an extra query??
array(1) {
["$set"]=>
array(1) {
["mRs.0.mos"]=>
array(1) {
[0]=>
array(2) {
["co"]=>
array(3) {
["$ref"]=>
string(24) "collections.collectables"
["$id"]=>
object(MongoId)#421 (1) {
["$id"]=>
string(24) "4da89ed15482295705000002"
}
["$db"]=>
string(10) "test"
}
["php"]=>
string(3) "cMo"
}
}
}
}
array(1) {
["$set"]=>
array(1) {
["mRs.1.mos"]=>
array(1) {
[0]=>
array(2) {
["co"]=>
array(3) {
["$ref"]=>
string(24) "collections.collectables"
["$id"]=>
object(MongoId)#424 (1) {
["$id"]=>
string(24) "4da89ed15482295705000003"
}
["$db"]=>
string(10) "test"
}
["php"]=>
string(3) "cMo"
}
}
}
}
array(1) {
["$set"]=>
array(1) {
["mRs.2.mos"]=>
array(1) {
[0]=>
array(2) {
["co"]=>
array(3) {
["$ref"]=>
string(24) "collections.collectables"
["$id"]=>
object(MongoId)#427 (1) {
["$id"]=>
string(24) "4da89ed15482295705000002"
}
["$db"]=>
string(10) "test"
}
["php"]=>
string(3) "cMo"
}
}
}
}
array(1) {
["$set"]=>
array(1) {
["mRs.3.mos"]=>
array(1) {
[0]=>
array(2) {
["co"]=>
array(3) {
["$ref"]=>
string(24) "collections.collectables"
["$id"]=>
object(MongoId)#430 (1) {
["$id"]=>
string(24) "4da89ed15482295705000002"
}
["$db"]=>
string(10) "test"
}
["php"]=>
string(3) "cMo"
}
}
}
}
3. WTF? Sets all Rows with new data, Previous queries are overwritten!!
And why is this in an extra query?
array(1) {
["$set"]=>
array(1) {
["mRs"]=>
array(4) {
[0]=>
array(1) {
["per"]=>
int(2)
}
[1]=>
array(1) {
["per"]=>
int(1)
}
[2]=>
array(1) {
["per"]=>
int(1)
}
[3]=>
array(1) {
["per"]=>
int(1)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment