Hi,
I have 2 questions concerning use of mongoDB classes:
1) how can I send mongo console commands directly from smalltalk
2) how to query on an embedded collection with an index
Model:
I have trips and each trip has an embedded collection of N receipts like
this:
{ "tripName" : "trip 1",
{"receipts" : [
{"receiptDescription" : "receipt 1" }
{"receiptDescription" : "receipt 2" }
{"receiptDescription" : "receipt 3" } ],
}
Index:
For quick search, I created an index on the embeded[1] receipts with this
command at the mongoDB console in a terminal (NOT in smalltalk)
(mongo console starts with mongo in the MongoDB/bin dir):
db.Trips.createIndex({"receipts.receiptDescription":1})
with a command like this in the mongoDB console
db.Trips.find({"receipts.receiptDescription":"receipt 1"})
I get the resulting receipt.
Before, I have to set the database with "use {databasename}" in thr mongodb
console
My questions:
1) how can I send mongo console commands directly from smalltalk, e.g. use
database, set index etc.
Is this possible?
I did not succeed with the mongo command: method, it always returns "no such
cmd".
2) how can I search for a receipt which is indexed as described from
smalltalk?
I did not succeed with the description [2] I am not sure if it is covered by
it.
Regards
Sabine
[1]
http://docs.mongodb.org/manual/core/index-multikey/#index-arrays-with-embedded-documents
[2] http://smallworks.eu/web/blog/2013-07-18-Voyage-advanced-queries
--
View this message in context:
http://forum.world.st/MongoDB-console-commands-query-embedded-indexed-fields-tp4840882.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.