You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically, I would want to find a document, or many documents that meet the requirements of a filter. BUT not send back all the bulky data that may be contained inside of that document. Sort of like a distinct query, but to only include certain whitelisted fields, or include everything but certain blacklisted fields.
luckily there are already database commands that do that for us!
🤔 Why?
Here's what I currently have to do for this, it's a bit more tedious, since you have to craft your own string, then split the documents yourself
#
# Output doc:
#_command-results::1 : {
# cursor : {
# firstBatch : [
# {doc1},
# {doc2},
# {etc}
# ]
# },
# ok : "1.0",
# $clusterTime : some timestamp bullshit,
# operationTime : int timestamp
#}
#
# ref: https://www.mongodb.com/docs/manual/reference/command/find/#output
set {_command-results::*} to results of mongo command "{""find"": ""my-collection"",""filter"": { ""player"": ""%{_uuid}%"" },""projection"": { ""_id"": 0, ""very-large-file-to-exclude"": 0, ""field-2-to-exclude"": 0 },}" of database {mongo-database}
# Convert the nested results into their own documents
loop {_command-results::*}:
set {_docs::*} to mongo embedded array with path "cursor.firstBatch" of loop-value```
The text was updated successfully, but these errors were encountered:
edited cause apparently I don't know how to markdown in github lmao
it would be awesome if we could just say excluding fields "field-1", "field-2" and "field-3" to blacklist fields - or alternatively including only "field-4" and "field-5" to do a whitelist instead
✒️ Description
Basically, I would want to find a document, or many documents that meet the requirements of a filter. BUT not send back all the bulky data that may be contained inside of that document. Sort of like a distinct query, but to only include certain whitelisted fields, or include everything but certain blacklisted fields.
luckily there are already database commands that do that for us!
🤔 Why?
Here's what I currently have to do for this, it's a bit more tedious, since you have to craft your own string, then split the documents yourself
The text was updated successfully, but these errors were encountered: