We're currently running our software forge off an old version of GForge
that uses postgres. If we switched to Allura, we'd have to migrate that
over to MongoDB. Are there any scripts or tools out there for doing so?
Secondly, we'd read that there can be challenges with using MongoDB for
certain types of queries. For instance, we tried probing MongoDB to pull
out the administrators for a certain project and had to perform several
find() steps to get that info, as opposed to issuing a single command when
working with postgres. (Specific commands below). Is there a better way
to do this?
Thanks!
Joy
(1) Find project id that contains the name "simtkproject2" from the
Collection "project". Result: ObjectId("53b39cd1574cff4112728520")
db.project.findOne({"shortname":/simtkproject2/},{"shortname":1,"_id":1})
{
"_id" : ObjectId("53b39cd1574cff4112728520"),
"shortname" : "simtkproject2"
}
(2) Find the ObjectId of the "Admin" role for that project from the
Collection "project_role". Result: ObjectId("53b39cd1574cff4112728521")
db.project_role.find({"project_id":ObjectId("53b39cd1574cff4112728520"),"n
ame":"Admin"})
{ "_id" : ObjectId("53b39cd1574cff4112728521"), "project_id" :
ObjectId("53b39cd1574cff4112728520"), "user_id" : null, "name" : "Admin",
"roles" : [ ObjectId("53b39cd1574cff4112728522") ] }
(3) Find the ObjectId of user(s) with "Admin" role ObjectId for that
project from the Collection "project_role". Result:
ObjectId("53b39b78574cff4112728492")
db.projecdb.project_role.find({"project_id":ObjectId("53b39cd1574cff411272
8520"),"roles":[ObjectId("53b39cd1574cff4112728521")]})
{ "_id" : ObjectId("53b39cd1574cff4112728526"), "project_id" :
ObjectId("53b39cd1574cff4112728520"), "user_id" :
ObjectId("53b39b78574cff4112728492"), "name" : null, "roles" : [
ObjectId("53b39cd1574cff4112728521") ] }
(4) Look up information on the "Admin" user from the Collection "user".
Result: "testsimtkuser1"
db.user.find({"_id": ObjectId("53b39b78574cff4112728492")})
{ "_id" : ObjectId("53b39b78574cff4112728492"), "username" :
"testsimtkuser1", "socialnetworks" : [ ], "localization" : { "city" :
null, "country" : null }, "last_password_updated" :
ISODate("2014-07-02T05:41:12.445Z"), "sex" : "Unknown", "disabled" :
false, "sent_user_message_times" : [ ], "webpages" : [ ], "timezone" :
null, "password" :
"sha256Lg\u00131\u0016hr|YOVDOh9bMkplxs4zg/xRdPOtsrYM6Qh1BQEoX0+xVPQ=",
"availability" : [ ], "skypeaccount" : null, "tool_preferences" : { },
"display_name" : "Test Simtk User 1", "preferences" : { "email_address" :
null, "email_format" : null, "disable_user_messages" : null,
"results_per_page" : 25 }, "skills" : [ ], "birthdate" : null, "tool_data"
: { }, "inactiveperiod" : [ ], "telnumbers" : [ ], "stats_id" :
ObjectId("53b39b78574cff4112728493"), "email_addresses" : [ ] }
---
Joy P. Ku, PhD
Director, <http://simbios.stanford.edu/> Simbios
Director of Communications & Training, <http://opensim.stanford.edu/>
NCSRR
Stanford University
(w) 650.736.8434, (f) 650.723.7461
Email: <mailto:[email protected]> [email protected]