LoadDocument now requires a static string collection name

37 views
Skip to first unread message

josh.le...@gmail.com

unread,
Oct 21, 2021, 9:38:41 AM10/21/21
to RavenDB - an awesome database
I had an index in 4.2 that used a LoadDocument call like this:
Map = participationDocs => from participationDoc in participationDocs
let signup = LoadDocument<IEventInstance>(participationDoc.SignupId, participationDoc.SignupId.Substring(0, participationDoc.SignupId.IndexOf('/')))

I've updated to 5.2.3 and the index now errors stating that the collection name must be a static string.
In order to accommodate this, I've had to create the multi-map index with selectors like the below (I've only included up to loading the "signup" as the rest isn't relevant)

AddMap<SignupParticipation> (participationDocs => from participationDoc in participationDocs
where participationDoc.SignupId.Substring(0, participationDoc.SignupId.IndexOf('/')).ToLower() == "physicalevents"
let signup = LoadDocument<IEventInstance>(participationDoc.SignupId, "physicalevents")

AddMap<SignupParticipation> (participationDocs => from participationDoc in participationDocs
where participationDoc.SignupId.Substring(0, participationDoc.SignupId.IndexOf('/')).ToLower() == "onlineevents"
let signup = LoadDocument<IEventInstance>(participationDoc.SignupId, "onlineevents")

AddMap<SignupParticipation> (participationDocs => from participationDoc in participationDocs
where participationDoc.SignupId.Substring(0, participationDoc.SignupId.IndexOf('/')).ToLower() == "ondemands"
let signup = LoadDocument<IEventInstance>(participationDoc.SignupId, "ondemands")

This means I have had to write out the map 3 times (more will need to be added too)
Is this a feature that was intentionally removed? Or have I missed a new potential implementation?

Help / advice is appreciated as this may be a pain to maintain

josh.le...@gmail.com

unread,
Oct 21, 2021, 9:44:29 AM10/21/21
to RavenDB - an awesome database
Reposted this on the github discussions: https://github.com/ravendb/ravendb/discussions/12893
Reply all
Reply to author
Forward
0 new messages