Join the conversation

Sign in to join this conversation, and others like it, in the communities you care about.

Wekan

Wekan is an open-source kanban board (Trello like) which allows a card-based task and to-do management.

Wekan / General

Cards.find() returns no cards

Cards.find() returns no cards

Wekan / General · December 26, 2020 at 11:28am (Edited 4 years ago)

Fooling around with putting together a simple My Cards implementation. However, I cannot get Cards.find() to return any cards. Boards.find() works perfectly.

cards() {
// return [{ title: 'Card 1' }, { title: 'Card 2' }];
const query = {
archived: false,
assignees: Meteor.userId(),
};
return Cards.find(query);
},

Is there something special that needs to be done to get Cards.find() to work?

P.S. Running the query in meteor mongo works perfectly.


December 26, 2020 at 3:20pm
cd wekan
./find.sh searchCards
./models/boards.js: searchCards(term, excludeLinked) {
./client/components/sidebar/sidebarSearches.js: return currentBoard.searchCards(this.term.get());
./client/components/lists/listBody.js: return board.searchCards(this.term.get(), false);
    • reply
    • like

    Hmm. I need the cards from all boards not just a certain board. Is there no way to do it with Cards.find(). I see it used in other places.

      • reply
      • like

      December 26, 2020 at 8:14pm

      That would be similar like searchCards, but without limiting it with boardId.

        • reply
        • like

        And it should show My Cards only from boards that user is member of

          • reply
          • like

          It seems that Cards.find() does search only from current board cards, that are loaded to webbrowser. To search from all cards of user etc, including cards that have not been loaded to webbrowser, I think you could search code with these keywords for related code: ./find.sh esSearch and ./find.sh EasySearch

            • reply
            • like

            Maybe with My Cards you are trying to do something similar like Public Boards https://github.com/wekan/wekan/pull/3008

              • reply
              • like

              December 27, 2020 at 2:59pm

              I guess I am being stupid, but I cannot understand why Cards.find() does not work. searchCards uses Cards.find() with boardId specified. The problem is not with my query as return Cards.find(); without a query (which should return all cards) returns an empty cursor.

              I have a feeling that models/cards.js is not being imported properly.

                • reply
                • like

                December 27, 2020 at 4:47pm

                Well, I don't know is it good idea to have both function cards() added and then use Cards.find(), those could get mixed

                  • reply
                  • like

                  Anyway, point is to use code that searches serverside, like esSearch etc. Because not all data is loaded to browserside.

                    • reply
                    • like

                    Meteor.js moves data automatically between clientside and serverside

                      • reply
                      • like

                      If you have only opened one board, only that board cards are loaded to browserside. Not from any other board.

                        • reply
                        • like

                        At browserside, there is minimongo, that is minimal version of MongoDB database, coded with Javascript

                          • reply
                          • like

                          Meteor.js web framework listens changes from MongoDB, and updates immediately boards or all logged in users, in realtime

                            • reply
                            • like

                            It's not anything about anybody being stupid.

                              • reply
                              • like

                              It's just that things in Meteor.js do not work similarly like in other web frameworks

                                • reply
                                • like

                                Meteor.js also automatically resolves write conficts of each user

                                  • reply
                                  • like

                                  Although, for some use cases, having manual control would in some cases improve things

                                    • reply
                                    • like

                                    Hmm, I don't know am I able to explain well enough.

                                      • reply
                                      • like

                                      Anyway, at https://github.com/wekan/wekan/pull/3008/files that code is very similar to what My Cards feature would be like. So, instead of adding Public, you would add My Cards. Then, you would copu that Public related code, so that instead of showing Public boards, you would show My Cards, creating new publication that sends to browserside all cards that are part of your My Cards, and no other data. Then, each of those cards would have link that points to that card full address in URL, the same you see in webbrowser URL bar currently when card is opened.

                                        • reply
                                        • like

                                        So I think, with so much already existing similar code and instructions, you should be able to add My Cards feature.

                                          • reply
                                          • like

                                          Oops typo above, copu that => copy that

                                            • reply
                                            • like