[Pharo-users] Problem with Mongo on Pharo5 ("collection already exists")

Sabine Manaa manaa.sabine at gmail.com
Wed May 25 09:35:22 EDT 2016


Hi Esteban,

can you please have a look again, I think you forgot to remove the signal
here
 (remove signal in the ifTrue case then it works):

addCollection: aString capped: aCapped size: aSize max: aMax
| command |
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]].
[ self command: command ]
on: MongoCommandError
do: [ :error |
"Tolerate error 48: collection already exists"
error isCollectionAlreadyExists
==>> ifTrue: [ (MongoCollectionAlreadyExists new collectionName: aString)
"signal" ] <<==
ifFalse: [ error signal ] ].
^MongoCollection database: self name: aString

2016-05-25 12:59 GMT+02:00 Esteban Lorenzano <estebanlm at gmail.com>:

> problem is not in Pharo 5 but in latest version of MongoTalk (who is
> loaded with Pharo 5 and apparently not with Pharo 4).
> I already submitted a fix for it, but you need to load latest version
> (still no configuration).
>
> Esteban
>
> > On 25 May 2016, at 12:18, Sabine Manaa <manaa.sabine at gmail.com> wrote:
> >
> > Hi,
> >
> > Is anyone already running Pharo5 with mongoDB already?
> >
> > loading my configurationOf in a new pharo5 image results in a problem
> with
> > mongDB.
> > loading the same in Pharo4 works fine.
> >
> > I reduced the problem to the following steps for reproduction:
> > 1) start Pharo5 and install VoyageMongo from the ProjectCatalog
> > 2) tools-> mongo Browser -> I see that I have connection to my database
> -ok
> > 3) (VOMongoRepository host: 'localhost' database: self databaseName)
> > enableSingleton.
> > 4) load ONLY my model classes which includes e.g. RKASystemMessage - load
> > nothing else
> > 5) Then I do  RKASystemMessage selectAll (there is ONE system message in
> the
> > mongo database) ==> this results in a non-responding image.
> > 6) when debugging into the selectAll, I see, that VoyageMongo tries to
> add a
> > collection (systemMessage), which is already there.
> >
> > in VOMongoRepositoryResolver>>collectionAt: aClass inDatabase: db
> > the collections attribute is empty -> this seems to be the problem
> > beause then it tries to do db addCollection: collectionName
> > which leads to a "collection already exists" mongo reply
> >
> > If you have a mongo database running, you should be able to reproduce the
> > problem.
> >
> > Regards
> > Sabine
> >
> >
> >
> >
> > --
> > View this message in context:
> http://forum.world.st/Problem-with-Mongo-on-Pharo5-collection-already-exists-tp4897315.html
> > Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> >
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20160525/f856be7f/attachment.html>


More information about the Pharo-users mailing list