Hi,

the solution to my initial issue is to create a class MyClass with two
class side methods

MyClass class >> isVoyageRoot
^ true

MyClass class >> descriptionContainer
    <voyageContainer>
    ^ VOContainer new
        collectionName: 'myCollection';
        yourself

Also, to properly read the data one should add instance variables to
depending on what is in the database. For example:

{ "_id" : ObjectId("5900a0175bc65a2b7973b48a"), "item" : "canvas", "qty" :
100, "tags" : [ "cotton" ] }

In this case MyClass should have instanceVariables: 'item qty tags' and
accessors.
Plus, on the class side

mongoItem
<mongoDescription>
^ VOToOneDescription new
attributeName: 'item';
kind: String;
yourself

mongoQty
<mongoDescription>
^ VOToOneDescription new
attributeName: 'qty';
kind: Integer;
yourself

mongoTags
<mongoDescription>
^ VOToOneDescription new
attributeName: 'tags';
kind: OrderedCollection;
yourself

After that one can connect to database and get the information.

| repository |
repository := VOMongoRepository database: 'databaseName'.
repository selectAll: MyClass

Big thanks to Sabine, Esteban and Holger!

Cheers,
Mark

2017-04-30 19:20 GMT+02:00 Sabine Manaa <manaa.sab...@gmail.com>:

> Happy to help. I got this information from Udo Schneider in slack several
> weeks ago.
> As far as I know, he works on an update for several things concerning
> mongo but I don't know when he will release it.
>
>
> chrismihaylyk [via Smalltalk] <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4944977&i=0>> schrieb am So.
> 30. Apr. 2017 um 16:45:
>
>> Sabine, thank you very much! It's very helpful, work fine.
>> 2017-04-30 17:09 GMT+03:00 Sabine Manaa <[hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=4944955&i=0>>:
>>
>>> Khrystyna ,
>>>
>>> I also use a new version of mongo with authentication (but only old
>>> version) and wired Tiger.
>>>
>>> I am not sure but possibly you can try to overwrite the following method
>>> to fix the problem:
>>>
>>> MongoDatabase>>collections
>>> | reply names |
>>> reply := self command: {(#listCollections -> 1)} asDictionary.
>>> names := ((reply at: 'cursor') at: 'firstBatch') collect: [ :each | each
>>> at: #name ].
>>> ^ names collect: [ :each | MongoCollection database: self name: each ]
>>>
>> 2017-04-30 12:24 GMT+02:00 Mark Rizun [via Smalltalk] <[hidden email]
>>> <http:///user/SendEmail.jtp?type=node&node=4944953&i=0>>:
>>>
>>
>>>> Mark
>>>>> once you have a solution could you post it because I would like to add
>>>>> your question to the voyage chapter.
>>>>> stef
>>>>>
>>>>
>>>> Sure thing, Stef.
>>>>
>>>>
>>>> ------------------------------
>>>> If you reply to this email, your message will be added to the
>>>> discussion below:
>>>> http://forum.world.st/Voyage-collecting-data-from-Mongo-
>>>> tp4944784p4944944.html
>>>>
>>> To start a new topic under Pharo Smalltalk Users, email [hidden email]
>>>> <http:///user/SendEmail.jtp?type=node&node=4944953&i=1>
>>>>
>>> To unsubscribe from Pharo Smalltalk Users, click here.
>>>> NAML
>>>> <http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>>
>>> ------------------------------
>>> View this message in context: Re: Voyage - collecting data from Mongo
>>> <http://forum.world.st/Voyage-collecting-data-from-Mongo-tp4944784p4944953.html>
>>>
>>> Sent from the Pharo Smalltalk Users mailing list archive
>>> <http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html> at
>>> Nabble.com.
>>>
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://forum.world.st/Voyage-collecting-data-from-Mongo-
>> tp4944784p4944955.html
>> To start a new topic under Pharo Smalltalk Users, email [hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=4944977&i=1>
>> To unsubscribe from Pharo Smalltalk Users, click here.
>> NAML
>> <http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
> ------------------------------
> View this message in context: Re: Voyage - collecting data from Mongo
> <http://forum.world.st/Voyage-collecting-data-from-Mongo-tp4944784p4944977.html>
> Sent from the Pharo Smalltalk Users mailing list archive
> <http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html> at Nabble.com.
>

Reply via email to