E
E
e2e42012-04-01 11:57:42
MongoDB
e2e4, 2012-04-01 11:57:42

MongoDB: SELECT const ?

Does MongoDB have the ability to create queries similar to the SQL variant:
SELECT 1 as num, username FROM 'users' LIMIT 1?
(Task: it is necessary to set some value in the request in order to get it as a result)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
deadkrolik, 2012-04-01
@deadkrolik

In 2.2 it will be possible to use $project. Now I don't know how. Can you clarify the issue? Why get the same field as the input.

R
rPman, 2012-04-01
@rPman

Apparently, temporary stubs are required during the development / development of the project, or connection to an existing database, the structure of which differs from the required one.
A universal solution - make a view in the database, in which add the necessary fields.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question