These are chat archives for FreeCodeCamp/HelpJavaScript

30th
Aug 2018
korzo
@korzo
Aug 30 2018 00:04
I think Parcel is rather new.
Javier Carrion
@JavaVista
Aug 30 2018 00:07
@aditya8349_twitter I was close. Thank you for clarifying and updating my code a bit. You rock and thank you for the help!
Brad
@bradtaniguchi
Aug 30 2018 00:17
parcel is probably overkill
Pagnito
@Pagnito
Aug 30 2018 00:19
im kinda of interested in it now tho
just to get started quickly on something
do i have to install it globally tho?
nvm got it to work localy
Brad
@bradtaniguchi
Aug 30 2018 00:23
@Pagnito you can always use npx and install in the project, regardless of what it is (for the most part)
Pagnito
@Pagnito
Aug 30 2018 00:23
it cant resolve my favicon tho T.T
Pagnito
@Pagnito
Aug 30 2018 00:33
it cant ind any of my static files
Brad
@bradtaniguchi
Aug 30 2018 00:35
@Pagnito i really suggest putting all your stuff you need into the static folder...
Pagnito
@Pagnito
Aug 30 2018 00:36
yea thats what i did, im not running node server anymore
its showing the correct path but somehow it cant resolve it
Brad
@bradtaniguchi
Aug 30 2018 00:37
are you now serving the static folder, and the path is correct relative to the static folder?
Pagnito
@Pagnito
Aug 30 2018 00:40
yea parcel is supposedly doing all that
i just installed parcel insdie package.json inside static
and ran parcel index.html
Brad
@bradtaniguchi
Aug 30 2018 00:41
sounds like it aint working hto
tho*
Pagnito
@Pagnito
Aug 30 2018 00:42
lol
Pagnito
@Pagnito
Aug 30 2018 00:49
well enough time wasted, ill stick to my webpack for now and use cdn d3 cuz i dont still dont wanna use webpack and all that jazz for this
korzo
@korzo
Aug 30 2018 01:03
@Pagnito Parcel didn't work for you?
Pagnito
@Pagnito
Aug 30 2018 01:04
yea for some reason it couldnt find my static files
even tho it made copies of them in the dist folder O.o
but said it couldnt resolve them
maybe cuz i installed it locally
but still should work
korzo
@korzo
Aug 30 2018 01:05

install parcel globally
npm install -g parcel-bundler
then from the project root folder (where package.json is) run
parcel static/index.html

open http://localhost:1234/

Pagnito
@Pagnito
Aug 30 2018 01:05
damn i dont wanna install it globally tho
korzo
@korzo
Aug 30 2018 01:06
then install it locally and run npx parcel static/index.html
Pagnito
@Pagnito
Aug 30 2018 01:06
i cant make static my root folder tho
right?
the only thing outside of it is my node server
korzo
@korzo
Aug 30 2018 01:07
with parcel you don't need node server. It has server build in
Pagnito
@Pagnito
Aug 30 2018 01:08
yea htats what i meant
mean*
so im making static my root folder since i created a packa json in it
nop
i still cant resolve
korzo
@korzo
Aug 30 2018 01:10
you are still trying to include d3 from node_modules?
Pagnito
@Pagnito
Aug 30 2018 01:10
Screen Shot 2018-08-29 at 9.10.11 PM.png
nah right now im just trying to load in js and css files
if i remove the favicon
then it moves on and cant resolve for css and js
Screen Shot 2018-08-29 at 9.11.47 PM.png
korzo
@korzo
Aug 30 2018 01:15
try ./favicon.png instead of /favicon.png
Pagnito
@Pagnito
Aug 30 2018 01:16
yea it seems to work wit the dots
jesus chrits wtf is up wit that cache folder tho
Morchid Chellali
@Morched23MJ
Aug 30 2018 01:21
@korzo, I need some help. Could you check out HelpFrontEnd discussion? :P
Pagnito
@Pagnito
Aug 30 2018 01:33
@korzo btw ty
korzo
@korzo
Aug 30 2018 01:38
@Pagnito parcel makes 2 folders : .cache and dist
cache is for temp data and dist is for compiled files. Also files are server from dist, not static
Pagnito
@Pagnito
Aug 30 2018 01:39
@korzo coo coo, i see
Pagnito
@Pagnito
Aug 30 2018 03:42
ok so i by accidnet commited the cche folder
cache folder
how do i uncommit it
i put it in my gitignore but it still pushed to gihub
Pagnito
@Pagnito
Aug 30 2018 03:48
o thank god
i did it
in case someone else would wonder
pangzhiliang
@pangzhiliang123
Aug 30 2018 08:01

function queue(arr, item) {
// 请把你的代码写在这里

array=arr.push(item);
return array; // 请修改这一行
}
queue([], 1);
queue([2], 1);
queue([5,6,7,8,91], 1);

// 初始化测试数据
var testArr = [1,2,3,4,5];

// 控制台输出
console.log("Before: " + JSON.stringify(testArr));
console.log(queue(testArr, 6)); // 你可以修改这一行来测试你的代码
console.log("After: " + JSON.stringify(testArr));

JJ Megma
@megma_jj_twitter
Aug 30 2018 09:43
@pangzhiliang123 English?
@pangzhiliang123 I imagine you are getting undefined
JJ Megma
@megma_jj_twitter
Aug 30 2018 09:50
@pangzhiliang123 when you declare a variable with push method like that its value will be the length of that array when you call it. You need to push the item to the array and then return the array. That will get rid of the undefined, I have not looked at the challenge so I'm not sure if it will pass the challenge for ya.
A queue usually involves a push an an unshift, if thats a good hint for ya
Stephen James
@sjames1958gm
Aug 30 2018 12:18
@pangzhiliang123 arr.push(item); this will return the new length of the array arr which is not what is asked here.
You need to remove the first element of arr and return that.
Javier Carrion
@JavaVista
Aug 30 2018 15:03
@ezioda004 Hey, I saw the solution and you clarified the whole thing for me. I was very close to the solution. You sir you rock. I am so grateful thank you for your help! :)
Jason Luboff
@JLuboff
Aug 30 2018 15:08
Morning :wave:
Javier Pons
@JavierPons
Aug 30 2018 15:13
anyone can help with js?
Jason Luboff
@JLuboff
Aug 30 2018 15:16
@JavierPons Possibly :)
Christopher McCormack
@cmccormack
Aug 30 2018 15:23
@JLuboff yo
Jason Luboff
@JLuboff
Aug 30 2018 15:23
@cmccormack Yo yo yo yippie yea yippie yo
Christopher McCormack
@cmccormack
Aug 30 2018 15:24
haha alright snoop
good mood?
Jason Luboff
@JLuboff
Aug 30 2018 15:24
Eh...nah...little hopped up on caffefine
Christopher McCormack
@cmccormack
Aug 30 2018 15:25
apparently... haha
I want what he's having
Jason Luboff
@JLuboff
Aug 30 2018 15:27
hah
What're you up to
Christopher McCormack
@cmccormack
Aug 30 2018 15:27
on calls right now, then not sure, I'll find something to dig into hehe
Jason Luboff
@JLuboff
Aug 30 2018 15:28
Calls...fun...
Christopher McCormack
@cmccormack
Aug 30 2018 15:28
yeah...
what bout you?
Jason Luboff
@JLuboff
Aug 30 2018 15:29
Just finished checking the database backups. Need to contact Lenovo.. and probably work on finishing up the improvements to my conference room sign app
Also at some point today need to work on creating a SQL migration checklist
Christopher McCormack
@cmccormack
Aug 30 2018 15:30
sounds like a busy day
Jason Luboff
@JLuboff
Aug 30 2018 15:30
Ya I'll stay busy I think :)
Christopher McCormack
@cmccormack
Aug 30 2018 15:31
well now you're a fancy shmancy whatever it is title you are now :)
Jason Luboff
@JLuboff
Aug 30 2018 15:31
Systems Developer!
Ronique Ricketts
@RoniqueRicketts
Aug 30 2018 15:32
Nice
Greetings
Christopher McCormack
@cmccormack
Aug 30 2018 15:32
@RoniqueRicketts what's up?
@JLuboff that IS fancy!
Jason Luboff
@JLuboff
Aug 30 2018 15:33
:joy:
Ronique Ricketts
@RoniqueRicketts
Aug 30 2018 15:34
Hey I am here about to try fixing some login issues I have with a project.
Christopher McCormack
@cmccormack
Aug 30 2018 15:34
Mine is super generic
Jason Luboff
@JLuboff
Aug 30 2018 15:34
@cmccormack Something Something Level 3?
Christopher McCormack
@cmccormack
Aug 30 2018 15:34
Sr. Infrastructure Engineer I
Jason Luboff
@JLuboff
Aug 30 2018 15:34
Or Level 3 Something Something
Christopher McCormack
@cmccormack
Aug 30 2018 15:34
lower number is better in these titles
Jason Luboff
@JLuboff
Aug 30 2018 15:34
Oh that sounds fancy too
Christopher McCormack
@cmccormack
Aug 30 2018 15:34
or lower number of capital i's :D
But it could apply to plumber, electrician, programmer, etc...
doesn't even describe your field! I think it's some industry standard though
Jason Luboff
@JLuboff
Aug 30 2018 15:36
Thats true
Christopher McCormack
@cmccormack
Aug 30 2018 15:38
I wouldn't mind being a plumber they get paid damn well
Jason Luboff
@JLuboff
Aug 30 2018 15:39
If you're a good one
Ronique Ricketts
@RoniqueRicketts
Aug 30 2018 15:43
I am merely a tech support agent :)
alpox
@alpox
Aug 30 2018 15:44
Y'all have fancy titles
Christopher McCormack
@cmccormack
Aug 30 2018 15:44
Fancy title and no cards to share it :)
alpox
@alpox
Aug 30 2018 15:44
At least you have one :D
Christopher McCormack
@cmccormack
Aug 30 2018 15:44
make one up!
Ronique Ricketts
@RoniqueRicketts
Aug 30 2018 15:44
@alpox yes they do except for myself
alpox
@alpox
Aug 30 2018 15:44
You can still create some cards ;)
@RoniqueRicketts Well more than I have xD
Christopher McCormack
@cmccormack
Aug 30 2018 15:45
no way I have a tiny wallet I'm not cluttering it up just to give cards to people I don't want to talk to haha
alpox
@alpox
Aug 30 2018 15:45
@cmccormack Fair enough xD
Christopher McCormack
@cmccormack
Aug 30 2018 15:45
I've always been curious about people that do use business cards, I wonder if it's still used
alpox
@alpox
Aug 30 2018 15:46
Here at times yes. I'm sometimes glad to get one otherwise I would forget the people
Christopher McCormack
@cmccormack
Aug 30 2018 15:46
And what ever happened to the NFC vCard share thing
Yeah I can see that
Jason Luboff
@JLuboff
Aug 30 2018 15:47
I have a box of 500 cards...with my old title...and...never given one out
Ronique Ricketts
@RoniqueRicketts
Aug 30 2018 15:48
@alpox trust me I barely make any
Christopher McCormack
@cmccormack
Aug 30 2018 16:00
@RoniqueRicketts you fix your login issues?
Ronique Ricketts
@RoniqueRicketts
Aug 30 2018 16:00
But on a serious note I can't get to implement Passportjs-facebook I am confused on this.
@cmccormack no.
Christopher McCormack
@cmccormack
Aug 30 2018 16:01
what issue are you having?
Ronique Ricketts
@RoniqueRicketts
Aug 30 2018 16:03
@cmccormack I think there is a flaw in my approach on this authentication thing. So Frontend is Create React App the backend is express which pumps out an API. Whenever I click login on the create react app shouldn't it check in facebooks api for a user then authenticate the user so they can access the api?
Christopher McCormack
@cmccormack
Aug 30 2018 16:03
I believe your backend should do that
your backend should be doing all the sensitive auth stuff
Ronique Ricketts
@RoniqueRicketts
Aug 30 2018 16:06
@cmccormack yeah so this is my backend middleware
const passport = require('passport'); 
const FacebookStrategy = require('passport-facebook').Strategy;

require('dotenv').config();

const User = require('../database/db');

passport.use(new FacebookStrategy({
    clientID: process.env.FB_ID,
    clientSecret: process.env.FB_SECRET,
    callbackURL: "https://type-chingu-project.herokuapp.com/board"
  },
  function(accessToken, refreshToken, profile, cb) {
    return User.findOrCreate({ facebookId: profile.id }, function (err, user) {
      if(err){
        return cb(err, false)
      }
      if(user){
        return cb(err, user);
      }
      else{
        return cb(null, false)
      }

    });
  }
));

module.exports = passport;
const express = require('express');
const db = require('/database/db');
const passport = require('/authmiddleware/facebookauth.js');
const path = require('path');

require('dotenv').config();

const app = express();


//This will be the built production version when the app is launched on HEROKU
app.use(express.static(path.join(__dirname, 'client/build')));

//::::: SHOULD HANDLE ALL HOME REQUEST
app.get('/', (req, res)=>{
    res.send('HELLO TYPER')
});

//::::: SHOULD HANDLE ALL BOARD REQUEST
app.get('/board', passport.authenticate('facebook', {session: false}) (req, res)=>{
    res.send({'board':'Success!'})
})

//::::: SHOULD HANDLE ALL PROFILE REQUEST
app.get('/profile', passport.authenticate('facebook', {session: false}), (req, res)=>{
    res.send({'profile':'Success!'})
})

//::::: SHOULD HANDLE ALL PRACTICE REQUEST
app.get('/practice', passport.authenticate('facebook', {session: false}) , (req, res)=>{
    res.send({'practice':'Success!'})
})
app.get('/*', (req, res)=>{
    res.send({'404':'Success!'})
})

app.get('*', (req, res)=>{
    res.sendFile(path.join(__dirname, 'client/build', 'index.html'))
})

app.listen(process.env.PORT || 3001, ()=> console.log(`>App listening on port ${process.env.PORT}`))
Christopher McCormack
@cmccormack
Aug 30 2018 16:09
do you have some login middleware, like app.post('/login', ...?
Ronique Ricketts
@RoniqueRicketts
Aug 30 2018 16:09
@cmccormack fudge I forgot that. OH< WHAT A DOOOF!!!!
Christopher McCormack
@cmccormack
Aug 30 2018 16:11
@RoniqueRicketts it's with twitter but should be enough if you need it nightlife app
Ronique Ricketts
@RoniqueRicketts
Aug 30 2018 16:11
@cmccormack that cool man. Just want an idea on how it all works :)
Christopher McCormack
@cmccormack
Aug 30 2018 16:13
iirc you hit the backend for login, then you call your auth strategy from your middleware using something like passport.authenticate("facebook" or whatever you named it
Ronique Ricketts
@RoniqueRicketts
Aug 30 2018 16:19
@cmccormack thank you I am going to work on that after helping my current customer.
Christopher McCormack
@cmccormack
Aug 30 2018 16:19
Cool man good luck
dinesh
@1532j0004kg
Aug 30 2018 16:19
hi guys i need help in wordpress hosting
Christopher McCormack
@cmccormack
Aug 30 2018 16:19
auth is hard but pretty satisfying once you get it working
Ronique Ricketts
@RoniqueRicketts
Aug 30 2018 16:19
What is IIRC @cmccormack
Christopher McCormack
@cmccormack
Aug 30 2018 16:20
If I remember correctly (IIRC)
Tom
@moT01
Aug 30 2018 16:55
:feet:
Jason Luboff
@JLuboff
Aug 30 2018 16:55
Those are some feet, yup
Tom
@moT01
Aug 30 2018 16:55
just walkin by
Christopher McCormack
@cmccormack
Aug 30 2018 16:58
Why are they red? creepy
Jason Luboff
@JLuboff
Aug 30 2018 17:03
Bloody footprints
Tom
@moT01
Aug 30 2018 17:10
yay
the joysticks arrived
Jason Luboff
@JLuboff
Aug 30 2018 17:14
Dope
Tom
@moT01
Aug 30 2018 17:17
i outta send ya a pic of my prototype
Jason Luboff
@JLuboff
Aug 30 2018 17:19
Word
Jason Luboff
@JLuboff
Aug 30 2018 17:24
Ah... refactoring code... Well shit..I don't need that loop!
Christopher McCormack
@cmccormack
Aug 30 2018 17:35
@JLuboff that's weird you had a loop not being used!
Jason Luboff
@JLuboff
Aug 30 2018 17:36
Oh no..it was being used...but.. the loop that occured before it could equally handle things
So basically I had 2 loops, when I only needed one
Christopher McCormack
@cmccormack
Aug 30 2018 18:07
@moT01 is that for the arcade cabinet?
hows it going?
Brad
@bradtaniguchi
Aug 30 2018 18:15
@JLuboff that's how I feel all dah time :P
Tom
@moT01
Aug 30 2018 18:18
IMG_0104.JPG
prototype ^^
ill test the joystick/buttons in the next day or two
Brad
@bradtaniguchi
Aug 30 2018 18:21
sick
Tom
@moT01
Aug 30 2018 18:22
thanks, ill make a vid for you guys when its done
needs some refinements
Jason Luboff
@JLuboff
Aug 30 2018 18:24
@moT01 Sick keyboard bro
Tom
@moT01
Aug 30 2018 18:24
really
the keyboard is what impresses you
i didnt build the keyboard
Jason Luboff
@JLuboff
Aug 30 2018 18:25
:joy:
Tom
@moT01
Aug 30 2018 18:25
probly 10$ at bestbuy back in the day
Brad
@bradtaniguchi
Aug 30 2018 18:25
haha
Jason Luboff
@JLuboff
Aug 30 2018 18:26
Nah the cabinet is looking good
Tom
@moT01
Aug 30 2018 18:26
its solid - that was some scrap plywood I had
once I get some real material and paint it... hopefully it'll look awesome
Brad
@bradtaniguchi
Aug 30 2018 18:53
I have an OOP (opinionated) best practice question, what should be declared first, private or protected methods?
alpox
@alpox
Aug 30 2018 18:54
@bradtaniguchi i dont think there is a best practice about this. Usually I cluster methods which belong logically together bug keep the private ones first, then protected, then public
But those build clusters (more or less)
So if a public function needs a helper private function I dont put the private one fully at the top but just above the public function
Brad
@bradtaniguchi
Aug 30 2018 19:03
Yea that's what I used todo, but I started getting paranoid and started ordering them. IDK how I feel about it tho
Muhammed Karim
@MuhammedKarim
Aug 30 2018 19:59
Hey Brad!
Brad
@bradtaniguchi
Aug 30 2018 20:02
@MuhammedKarim hello
Muhammed Karim
@MuhammedKarim
Aug 30 2018 20:06
Remember me?
Doubt it :frowning:
Brad
@bradtaniguchi
Aug 30 2018 20:07
Your name sounds familar but a lot of people come thru here every day, and I'm bad with names haha
sorry :D
Jason Luboff
@JLuboff
Aug 30 2018 20:08
Brad doesn't even remember me
Muhammed Karim
@MuhammedKarim
Aug 30 2018 20:11
Lol i thought so, it's fine :laughing:
Brad
@bradtaniguchi
Aug 30 2018 20:12
@JLuboff who are you again? :P
Muhammed Karim
@MuhammedKarim
Aug 30 2018 20:12
:smile:
Jason Luboff
@JLuboff
Aug 30 2018 20:13
Man...some people want too much ability in an app
Brad
@bradtaniguchi
Aug 30 2018 20:17
they want all the features
Jason Luboff
@JLuboff
Aug 30 2018 20:18
They want one user to be able to modify literally everyones responses/action items/whatever. The only thing he pretty much can't do, is modify the original request, which now they're asking about giving him that ability which I don't think he should be able to
Brad
@bradtaniguchi
Aug 30 2018 20:22
Sounds like a very familiar project with the same familiar people....
Christopher McCormack
@cmccormack
Aug 30 2018 20:23
@JLuboff make sure you code in a history so they can't be sneaky!
implement it in blockchain
:tm:
Jason Luboff
@JLuboff
Aug 30 2018 20:24
Holy hell. So he sent me an email with what he wanted something changed to...I change it (I didn't back up, why would I) and he comes over saying "oh no, it wasn't supposed to be that it was supposed to be a part of it) When his email specifcally says "Please edit to say"
Brad
@bradtaniguchi
Aug 30 2018 20:26
ayayaya
Jason Luboff
@JLuboff
Aug 30 2018 20:27
@cmccormack Once we upgrade our SQL server...I'm going to implement Temporal tables (aka history tables). Uses more space but fuck it, we need it for this reason
Christopher McCormack
@cmccormack
Aug 30 2018 20:27
@JLuboff nah use blockchain :tm: with Luboff coins
Jason Luboff
@JLuboff
Aug 30 2018 20:28
You think I'm smart enough to understand blockchain? psh
I bought bitcoin when it was way too expensive. I'm deep deep in the hole mn
Christopher McCormack
@cmccormack
Aug 30 2018 20:29
It's just a linked list isn't it? haha
alpox
@alpox
Aug 30 2018 20:29
@cmccormack yes, with some twirkd
Twirks*
Christopher McCormack
@cmccormack
Aug 30 2018 20:29
Twirks?
is that even a word?
Jason Luboff
@JLuboff
Aug 30 2018 20:29
It shakes its ass?
alpox
@alpox
Aug 30 2018 20:30
@cmccormack now it is :sunglasses:
Christopher McCormack
@cmccormack
Aug 30 2018 20:30
haha nice
Brad
@bradtaniguchi
Aug 30 2018 20:30
I legit saw a bitcoin kiosk at the mall the other day, I coulda put my credit card in and bought bitcoin.... Idk where it goes, or where it comes from but the koisk was there
Christopher McCormack
@cmccormack
Aug 30 2018 20:31
you would provide your public key and it would be added to the ledger
alpox
@alpox
Aug 30 2018 20:31
And your money leaves to crypto-nirvana
Brad
@bradtaniguchi
Aug 30 2018 20:31
That isn't something I'd know off the top of my head tho right?
Christopher McCormack
@cmccormack
Aug 30 2018 20:31
all bitcoin is is a series of transactions in a ledger, that can be traced all the way back to the original entry
Yeah it's definitely not for the lumpen
Jason Luboff
@JLuboff
Aug 30 2018 20:32
Well.. looks like they're in luck..I still have the original request open with the original text
Christopher McCormack
@cmccormack
Aug 30 2018 20:33

@JLuboff

(I didn't back up, why would I)

lol

Jason Luboff
@JLuboff
Aug 30 2018 20:34
My original bitcoin investment of $50 (minus fees of I think $3?) is worth currently $24.76.
Christopher McCormack
@cmccormack
Aug 30 2018 20:34
may as well hang onto it, either let it soar or let it die
Jason Luboff
@JLuboff
Aug 30 2018 20:34
@cmccormack Funny thing I did it in a transaction just in case I fucked something up, but verified it and was like "Ok cool!" commit;
@cmccormack Yup. I don't count on that money so just letting it sit
Christopher McCormack
@cmccormack
Aug 30 2018 20:34
just don't lose your private key
Jason Luboff
@JLuboff
Aug 30 2018 20:35
I have it through CoinBase
I also have one Garlic Coin. That...that was a big flop (I got it for free though)
Christopher McCormack
@cmccormack
Aug 30 2018 20:37
haha man people make some dumb stuff
Jason Luboff
@JLuboff
Aug 30 2018 20:40
haha
People went crazy about it too
but I think its worth under a penny...at its high I think it may have been a few dollars
Brad
@bradtaniguchi
Aug 30 2018 21:07
alright, so I'm testing a "search" endpoint, and amazing it worked the first time without crashing anything, BUT, it returned 1 item instead of an array of items....
Jason Luboff
@JLuboff
Aug 30 2018 21:08
Involves a database query?
Brad
@bradtaniguchi
Aug 30 2018 21:11
Oh I was calling the create endpoint :trollface:
Jason Luboff
@JLuboff
Aug 30 2018 21:11
oops
Brad
@bradtaniguchi
Aug 30 2018 21:11
welp that's a bug, since there's still no validation on the damn thing
Jason Luboff
@JLuboff
Aug 30 2018 21:12
heh
Brad
@bradtaniguchi
Aug 30 2018 21:16
long story short, I called the create endpoint with an empty object to test the defaults of the search endpoint (both are post), I was able to create something without any valid fields (since my post was an empty object)
Jason Luboff
@JLuboff
Aug 30 2018 21:17
No validation on front or backend? Or were you using something like postman?
Brad
@bradtaniguchi
Aug 30 2018 21:19
I was using postman, there's validation on the front-end but there should be validation on the backend as well
Jason Luboff
@JLuboff
Aug 30 2018 21:19
Ah
Brad
@bradtaniguchi
Aug 30 2018 21:19
nothing critical, just be able to make something with no name haha
Jason Luboff
@JLuboff
Aug 30 2018 21:22
That'd be good
Brad
@bradtaniguchi
Aug 30 2018 22:10
Alright so Mongodb sort operator uses the order of the keys in your object to determine the order of operations, IE collection.sort({name: 1, description: 1}) means sort by name first then description. Wtf why?
Jason Luboff
@JLuboff
Aug 30 2018 22:45
@bradtaniguchi what doesn't make sense about that?
No different than with SQL Order By name, description
Brad
@bradtaniguchi
Aug 30 2018 22:46
but it's a javascript object, and technically javascript object keys have no order
Jason Luboff
@JLuboff
Aug 30 2018 22:46
Nope, its BSON
So similar but not exactly JSON
Brad
@bradtaniguchi
Aug 30 2018 22:51
if I'm in node and using the mongodb driver I have to give it an object right?
Jason Luboff
@JLuboff
Aug 30 2018 22:52
Mmm... I guess lol
Well no..you can send in an array...of objects
but what is an array but an object
Brad
@bradtaniguchi
Aug 30 2018 23:28
for the .sort method they support an array of objects which works perfectly, but the aggregate method $sort doesn't support it -_-
Jason Luboff
@JLuboff
Aug 30 2018 23:35
I think you would have to unwind the array?
Brad
@bradtaniguchi
Aug 30 2018 23:36
Im sorry?
Brad
@bradtaniguchi
Aug 30 2018 23:40
damnit I just deleted instead of edited my post -_-
spent a good time on it too
@JLuboff thanks, but Its an issue with the $sort aggregate operator not taking an array, unlike the sort method available after a .find()
Jason Luboff
@JLuboff
Aug 30 2018 23:43
Correct, you would need to unwind the array to be able to then sort I believe, but then that is manipulating your data structure quite a bit
Little more refactoring tomorrow and think I'll be done with fixing up my conference room sign stuff
Brad
@bradtaniguchi
Aug 30 2018 23:58
Nice :D
Jason Luboff
@JLuboff
Aug 30 2018 23:59
And now time to go home. See ya