addCollection: aString capped: aCapped size: aSize max: aMax
| command reply |
command := SmallDictionary new.
command at: 'create' put: aString.
aCapped ifTrue: [
command at: 'capped' put: true.
aSize ifNotNil: [command at: 'size' put: aSize].
aMax ifNotNil: [command at: 'max' put: aMax]].
reply := self command: command.
(reply at: 'ok' ifAbsent: [self halt]) = 1.0 ifFalse: [
+++ "Tolerate error 48: collection already exists"
+++ ((reply at: 'code') = 48) ifFalse: [ ^self error: 'Command failed' ]
--- ^self error: 'Command failed'.
].
^MongoCollection database: self name: aString
If no problem, I'll release 1.9.3 with this small change.