SUBJECTS
|
BROWSE
|
CAREER CENTER
|
POPULAR
|
JOIN
|
LOGIN
Business Skills
|
Soft Skills
|
Basic Literacy
|
Certifications
About
|
Help
|
Privacy
|
Terms
|
Email
Search
Test your basic knowledge |
Mongo Db
Start Test
Study First
Subject
:
it-skills
Instructions:
Answer 50 questions in 15 minutes.
If you are not ready to take this test, you can
study here
.
Match each statement with the correct term.
Don't refresh. All questions and answers are randomly picked and ordered every time you load a test.
This is a study tool. The 3 wrong answers for each question are randomly chosen from answers to other questions. So, you might find at times the answers obvious, but you will see it re-enforces your understanding as you take the test each time.
1. Returns all the documents matching the optional properties.
use <database name>
db.commandHelp("commandName")
db.<collection>.find([properties]);
$pop
2. Used to describe a variable as not having been initialized.
undefined
64-Bit Integer
help
regular expression
3. Meta query conditional generating a modulus with the selector operand. Checks to see if the field value when divided by one value has the remainder of the second value.
$addToSet
$mod
db.<collection>.insert({document});
binary data
4. Adds a value to the array only if its not in the array already. Otherwise, if the field is not present, it sets the field to the array value. ex: { $addToSet : { a : { $each : [ 3 , 5 , 6 ] } } }
$not
$addToSet
date
db.cloneDatabase(fromhost)
5. Appends a value to field - if the field is an existing array. Otherwise it sets the field to the array [value] if field is not present. ex: { $push : { field : value } }
$or
$push
$lte
$where
6. In BSON - represents the smallest possible value.
Upsert
minimum value
db.runCommand({fsync:1,lock:1,async:1})
db.<collection>.find([properties]);
7. Lists all the collections in the database in use.
boolean
db.<collection>.insert({document});
show collections
object id
8. command to start the mongodb process.
$pushAll
regular expression
mongod
db.getLastError()
9. Flushes all pending writes to data files. The lock option allows one to safely snapshot the database's data files. The async option returns focus to the console immediately while the task runs in the background.
$pullAll
db.<collection>.find([properties]);
object id
db.runCommand({fsync:1,lock:1,async:1})
10. Returns help information for a command.
$pushAll
db.commandHelp("commandName")
db.getLastError()
db.runCommand({fsync:1,lock:1,async:1})
11. set of UTF-8 characters.
Object.bsonsize({document});
string
$elemMatch
$unset
12. Meta query conditional used to negate the selector.
$not
db.<col>.remove({selector});
$nin
date
13. Greater than or equal query conditional. ex: db.<col>.find({numVal: {$gte:3}});
$lt
$lte
$gt
$gte
14. Array specific conditional used to select based on the length or set-size of an array field value.
$all
$size
$pull
$ne
15. changes the database on which you are working.
use <database name>
db.myCollection.ensureIndex({keypattern},[{options}])
$nin
$lte
16. Less than query conditional. ex: db.<col>.find({numVal: {$lt:3}});
32-Bit Integer
$lt
undefined
db.copyDatabase(frmDBName, toDBName, [frmHostName], [user], [pwd]);
17. Positional operator that holds the position of the first matched array item in the query. Used to find an array member and then manipulate it. ex: {$inc:{'comments.$.votes':1}} where comments looks like: "comments" : [ { "by" : "joe", "votes" : 3 },
$set
$pushAll
db.<collection>.find([properties]);
$
18. Special keys passed in an update call to specify complex update operations - such as alter - adding - or removing keys - and even manipulating arrays and embedded documents.
Update Modifiers
$nin
db.copyDatabase(frmDBName, toDBName, [frmHostName], [user], [pwd]);
$unset
19. Clone the current database (implied by 'db') from another host.
embedded document
db.<collection>.find([properties]);
db.cloneDatabase(fromhost)
db.commandHelp("commandName")
20. Operator allowing the execution of arbitrary javascript as part of the selector.
db.cloneDatabase(fromhost)
$set
$where
Multi-updates
21. Returns help information for a command.
mongod
$elemMatch
$all
db.commandHelp("commandName")
22. The local variable representation of a query. Uniquely - the cursor does not hold the results but instead access to the results.
Upsert
regular expression
use <database name>
Cursor
23. changes the database on which you are working.
$lt
use <database name>
batch insert
Update Modifiers
24. Returns information about the last operation. Not necessarily error data - the return can contain things like number of records updated.
db.getLastError()
db.<col>.remove({selector});
embedded document
$elemMatch
25. Standard javascript regular expressions. These can be stored in documents
regular expression
$not
$lte
64-bit floating point numbers
26. ...
$mod
batch insert
object id
date
27. Returns all the documents matching the optional properties.
64-Bit Integer
db.<collection>.find([properties]);
batch insert
$set
28. Update modifier that set the value of a key and if the key does not exist, it will create the key. ex: db.<col>.update({selector},{"$set":{"someKey":"someValue"}});
$gt
key.index
$set
db.help([commandName]);
29. Update modifier used to increment a value. ex: {"$inc":{"counter":2}}
$mod
BSON
$inc
mongod
30. Renames a field from the one indicated to the new field name. ex: { $rename : { old_field_name : new_field_name } }
$where
code
mongod
$rename
31. Creates an index on property(s). Options can describe the type of sorting, uniqueness, etc.
db.myCollection.ensureIndex({keypattern},[{options}])
show collections
boolean
$gt
32. Removes an element from an array based on the value of the field option being 1 or -1 for last or first element respectively. ex: { $pop : { field : -1 } }
$inc
$pop
$in
$slice
33. Deletes a given field. ex: { $unset : { field : 1} }
$unset
db.<col>.help([commandName]);
$size
$pullAll
34. Removes all occurrences of a value from a field. ex: { $pull : { field : _value } }
db.myCollection.ensureIndex({keypattern},[{options}])
db.commandHelp("commandName")
64-Bit Integer
$pull
35. Not supported by the javascript shell and are converted to 64-bit floating point numbers.
64-Bit Integer
$all
use <database name>
$pullAll
36. Adds a document to a collection.
mongod
db.<collection>.insert({document});
$elemMatch
batch insert
37. The standard number representation in the javascript shell.
64-bit floating point numbers
$
Update Modifiers
db.<collection>.insert({document});
38. Returns one document matching the optional properties.
db.myCollection.ensureIndex({keypattern},[{options}])
$in
db.<collection>.findOne([properties]);
minimum value
39. Updates all matching documents, not just the first, that match the selector.
db.<collection>.find([properties]);
Multi-updates
use <database name>
$set
40. Deletes documents from the collection based on the selector.
$lt
null
show collections
db.<col>.remove({selector});
41. Used to represent both a null value and a nonexistent field.
$where
show collections
mongo
null
42. command to start the mongo shell.
document
array
mongo
mongod
43. Syntax used for selectors to be specific to a certain element position within an array.
db.<collection>.find([properties]);
$pullAll
db.help([commandName]);
key.index
44. Update call that inserts a new document if no update match is found. Allows the same code to be used for inserts as well as updates.
db.cloneDatabase(fromhost)
undefined
$inc
Upsert
45. Not supported by the javascript shell and are converted to 64-bit floating point numbers.
Object.bsonsize({document});
db.<collection>.insert({document});
32-Bit Integer
$set
46. String of arbitrary bytes.
binary data
date
$or
db.copyDatabase(frmDBName, toDBName, [frmHostName], [user], [pwd]);
47. Adds a document to a collection.
db.<collection>.insert({document});
array
$pushAll
$lt
48. A document contained by a parent document. The embedded document is a value of a key in the parent document.
undefined
$size
embedded document
$lt
49. Stored as milliseconds since the epoch.
document
date
db.<collection>.insert({document});
$mod
50. Copies an entire database from one name on one server to another name on another server. Omit frmHostName to copy from one name to another on the same server.
$pull
$size
db.getLastError()
db.copyDatabase(frmDBName, toDBName, [frmHostName], [user], [pwd]);