This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
import "./App.css"; | |
function App() { | |
const [fibonacci, setFibonacci] = useState(null); | |
const [value, setValue] = useState(null); | |
const [initialNumber, setInitialNumber] = useState(null); | |
function fibonacciHelper(number) { | |
if (number < 2) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MongoDB.Driver; | |
var mongoURL = new MongoUrl(""); | |
var client = new MongoClient(mongoURL); | |
var dbList = client.ListDatabases().ToList(); | |
Console.WriteLine("The list of databases on this server is: "); | |
foreach (var db in dbList) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
_id: ObjectId("5b9d9b9b9b9b9b9b9b9b9b9b"), | |
first_name: "John", | |
last_name: "Doe", | |
phone: "123-456-7890", | |
age: 25, | |
start_date: ISODate("2018-09-01T00:00:00.000Z"), | |
settings: { | |
theme: "dark", | |
switch_controls: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO users (first_name, last_name, phone, age) | |
VALUES | |
('Nancy', 'Smith', "5234560987", 29); | |
INSERT INTO users (first_name, last_name, phone, age) | |
VALUES | |
('Douglas', 'Lowel', "5234768907", 23), | |
('Kai', 'Tran', "9198761234", 43), | |
('Linzey', 'Rivers', "7659023456", 54), | |
('Mira', 'Chan', "7650981234", 88); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.transfers.aggregate( [ | |
{ | |
$lookup: | |
{ | |
from: "accounts", | |
localField: "transfer_id", | |
foreignField: "transfers_complete", | |
pipeline: [ | |
{ $project: { _id: 0, account_id: 1, account_holder: 1 } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.sales.deleteOne({_id: ObjectId("5bd761dcae323e45a93ccff1")}) | |
db.sales.deleteMany({ storeLocation: {$in: [ 'Denver', 'New York' ]} }); | |
db.sales.deleteMany({}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.zips.find( | |
{ state: "NY", pop: { $gte: 1000, $lte: 5000 }}, | |
{_id: 0, state: 1, city: 1, pop: 1} | |
).sort({pop: -1}) | |
.limit(10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.zips.findOne({}) | |
db.zips.find({state: 'AZ', pop: {$lt: 500}}, {_id: 0, city: 1}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require('mongoose'); | |
main().catch(err => console.log(err)); | |
async function main() { | |
await mongoose.connect(<Atlasconnection-string>); | |
const userSchema = new mongoose.Schema({ | |
name: { | |
type: String, |
OlderNewer