Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variables #27

Closed
noway1987 opened this issue Mar 23, 2018 · 2 comments
Closed

Variables #27

noway1987 opened this issue Mar 23, 2018 · 2 comments

Comments

@noway1987
Copy link

First i want to thank you for your great work!

I'm really new to node and everything around it.
Since about 2 days im stuck. :(

What i'm trying to build is a query from a mongoDB an send the output as message.
In detail:

  • user sends message: '!nickname'
  • event starts a query ->
    Member.aggregate([
    { $group : { _id : '$nick', nick: {$first: '$nick'}, might:{$first: '$might'}}},
    { $sort: {date : -1}
    ]}
  • .then(member => {
    event.reply(member)
    });

In Text:

A user send a nick with an ! before as trigger.
Query in Mongo will search for all entries matching the username (without -> !)
Result will be sorted for the latest entry and the grouped output will be sent as Message.
like:
-username
-might
-date

I dont know what to do, i'm really so. Maybe im not getting the syntax right, or anything else ist wrong.

Please help me 🙈

Side node: im able to get the result i trying to archive with express + handlebars engine but this is different.

@noway1987
Copy link
Author

I forgot:

I'm able to query 1 user by case: 'username' but im not able to fetch a message as variable with a trigger like ! or maybe # or something else

@boybundit
Copy link
Owner

This is more like MongoDB question. I'd suggest you ask on https://stackoverflow.com/ to get more help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants