MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1g6kat3/mongodbwasamistake/lslfo7n/?context=3
r/ProgrammerHumor • u/fisadev • Oct 18 '24
446 comments sorted by
View all comments
Show parent comments
2
If you’re in js land, single or double quotes is down to the whims of whoever set up your formatter. This is a valid object in JS:
{
skeptical: true,
"skeptical": true,
'skeptical':true,
`skeptical`:true,
[someVarWithValueSkeptical]: true
}
-2 u/[deleted] Oct 18 '24 Spec says double quotes for strings. Specifically U+0022Also your array as identifier is an abomination, but is correct aside from the double quote issue.Edit: oh yes JavaScript. Sigh. 3 u/hyrumwhite Oct 18 '24 For JSON. Unless you’re hitting your db with curl, you’ll be using whatever client your language supports. If you’re using JS, objects will follow the ecmascript spec. 0 u/[deleted] Oct 18 '24 That may have been why the server side wanted everything as quoted strings, as it’s the only thing that worked.As clearly shown in OP nobody really follows the spec :D → More replies (4)
-2
Spec says double quotes for strings. Specifically U+0022
Also your array as identifier is an abomination, but is correct aside from the double quote issue.
Edit: oh yes JavaScript. Sigh.
3 u/hyrumwhite Oct 18 '24 For JSON. Unless you’re hitting your db with curl, you’ll be using whatever client your language supports. If you’re using JS, objects will follow the ecmascript spec. 0 u/[deleted] Oct 18 '24 That may have been why the server side wanted everything as quoted strings, as it’s the only thing that worked.As clearly shown in OP nobody really follows the spec :D → More replies (4)
3
For JSON. Unless you’re hitting your db with curl, you’ll be using whatever client your language supports. If you’re using JS, objects will follow the ecmascript spec.
0 u/[deleted] Oct 18 '24 That may have been why the server side wanted everything as quoted strings, as it’s the only thing that worked.As clearly shown in OP nobody really follows the spec :D → More replies (4)
0
That may have been why the server side wanted everything as quoted strings, as it’s the only thing that worked.
As clearly shown in OP nobody really follows the spec :D
→ More replies (4)
2
u/hyrumwhite Oct 18 '24
If you’re in js land, single or double quotes is down to the whims of whoever set up your formatter. This is a valid object in JS:
{
skeptical: true,
"skeptical": true,
'skeptical':true,
`skeptical`:true,
[someVarWithValueSkeptical]: true
}