Page 1 of 1

Multiple "Messages" Collections?

Posted: Sun May 11, 2014 12:29 am
by Michael Brandon

I currently have multiple "venue/places pages" where I have added an HTML div with labels to allow users to read & post messages/comments for the venue using messageList & messageCreate DB services.

However, I originally only set up one "messages" collection in the DB so naturally each venue page lists the same collected Messages from the List Service. To get this to work as needed, should I create separate "Messages" collections, one specific to each page? That way only messages pertaining to that Venue Page are listed? Like Venue1messages collection; Venue2messages collection.... and so on.Then create a single List/Create DB service unique to each page?

In my case I have 9 unique venue pages, and I want each user to be able post messages to each specific page uniquely.

Thanks for your help.


Multiple "Messages" Collections?

Posted: Sun May 11, 2014 1:14 am
by Igor

Hello,

You don't need create multiple collections. You can create one collection with additional field (for example "page_number") and use Query parameters to list and update DB records.


Multiple "Messages" Collections?

Posted: Sun May 11, 2014 1:41 am
by Michael Brandon

Got it. Makes sense. And thank you for the extremely quick response.


Multiple "Messages" Collections?

Posted: Mon May 12, 2014 7:21 pm
by Michael Brandon

Sorry, but real quick. I've added the "venueName" field into my collection, and added the parameter to both create & list services.

Question, how do I map a "pageName" into the parameter value "venueName" on messageCreate service? That way, when someone creates a message on a page, that pageName is then added into the "venueName"

Once that "venueName" is created, I believe you are suggesting I use something like this on each page's messageList service.

Add where parameter with this: {"venueName": {"$regex": "pageName1"}}'

Yes?


Multiple "Messages" Collections?

Posted: Tue May 13, 2014 8:26 am
by Kateryna Grynko

Hi Michael,

No, use the following:pre{"venueName": "pageName1"}/pre