Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

mongodb projection example

{ $project: { "field1": 0, "field2": 1, ... } } 
Comment

projection in mongodb

Projection in mongoDB : 
-> You can select the field you want in query to return 
-> if you want field use {"field":1}
-> _id field is compasary if you dont want it use {"_id":0}


db.users.find({},{name:1,email:1, id:0}).pretty();
Comment

PREVIOUS NEXT
Code Example
Javascript :: command to start a new react app using vite 
Javascript :: fizz buzz program in javascript 
Javascript :: Encoding and Decoding Base64 Strings in Node.js 
Javascript :: angular disable select dropdown 
Javascript :: react enzyme 
Javascript :: select parent of elemt 
Javascript :: cos in javascript 
Javascript :: javascript divide string into two parts 
Javascript :: child_process npm 
Javascript :: axios node js 
Javascript :: babel debugging 
Javascript :: [W] undefined:undefined - Ruleset uses old version (version [1]). Please update to the latest version (version [2]). 
Javascript :: regex 
Javascript :: convert string to lowercase javascript 
Javascript :: delete an element to an array 
Javascript :: remove array item with index 
Javascript :: remove substring from string liquid shopify 
Javascript :: redux toolkit how to set empty initial state 
Javascript :: javascript add update query parameter to url 
Javascript :: javascript loop an array check if a number is even 
Javascript :: map a square to a circle 
Javascript :: HOW TO ADD INDEXES TO EXISTING COLLECTIONS mongodb 
Javascript :: Learn how to use Js export and import. 
Javascript :: javascript filter array match includes exact 
Javascript :: javascript break and continue 
Javascript :: entypo icons react native 
Javascript :: como eliminar un elemento del dom con javascript 
Javascript :: null + undefined 
Javascript :: datepicker react native 
Javascript :: redux reducer 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =