Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to use $literal #2273

Unanswered
yusufzainsantosa asked this question in Q&A
Discussion options

How to use $literal in project to add new field when do a query?

Bids Collection
{ "_id" : 1, "item" : "abc123", price: "2ドル.50" } { "_id" : 2, "item" : "xyz123", price: "1" } { "_id" : 3, "item" : "ijk123", price: "1ドル" }

db.bids.aggregate( [ { $project: { total: { $literal: 100 } } } ] )

{ "_id" : 1, "item" : "abc123", price: "2ドル.50" ,total:100} { "_id" : 2, "item" : "xyz123", price: "1" ,total:100} { "_id" : 3, "item" : "ijk123", price: "1ドル",total:100 }

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #2272 on June 11, 2021 01:44.

AltStyle によって変換されたページ (->オリジナル) /