Michael Brandon
Posts: 0
Joined: Mon Apr 21, 2014 9:17 pm

Multiple "Messages" Collections?

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.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Multiple "Messages" Collections?

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.

Michael Brandon
Posts: 0
Joined: Mon Apr 21, 2014 9:17 pm

Multiple "Messages" Collections?

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

Michael Brandon
Posts: 0
Joined: Mon Apr 21, 2014 9:17 pm

Multiple "Messages" Collections?

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?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Multiple "Messages" Collections?

Hi Michael,

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

Return to “Issues”