Last active
August 29, 2015 14:20
-
-
Save goedecke/a75ad93dc3f8f5be8cc6 to your computer and use it in GitHub Desktop.
Tutorial de Mongo
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
Estos son un conjunto de pequeños scripts para ayudar a entender cosas de programación |
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
mongod --port 27666 --dbpath data --replSet rep1 |
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" : "rep1", | |
"version" : 1, | |
"members" : | |
[ | |
{ | |
"_id" : 0, | |
"host" : "CYLON-MACHINE:27666" | |
} | |
] | |
} |
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
{ | |
"set" : "rep1", | |
"date" : ISODate("2013-12-10T10:42:29Z"), | |
"myState" : 1, | |
"members" : | |
[ | |
{ | |
"_id" : 0, | |
"name" : "CYLON-MACHINE:27666", | |
"health" : 1, | |
"state" : 1, | |
"stateStr" : "PRIMARY", | |
"uptime" : 840, | |
"optime" : | |
{ | |
"t" : 1386671943, | |
"i" : 1 | |
}, | |
"optimeDate" : ISODate("2013-12-10T10:39:03Z"), | |
"self" : true | |
} | |
], | |
"ok" : 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
{ | |
"_id" : "rep1", | |
"version" : 3, | |
"members" : | |
[ | |
{ | |
"_id" : 0, | |
"host" : "CYLON-MACHINE:27666" | |
}, | |
{ | |
"_id" : 1, | |
"host" : "CYLON-MACHINE:27667" | |
}, | |
{ | |
"_id" : 2, | |
"host" : "CYLON-MACHINE:27668" | |
} | |
] | |
} |
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
{ | |
"set" : "rep1", | |
"date" : ISODate("2013-12-11T21:33:19Z"), | |
"myState" : 1, | |
"members" : | |
[ | |
{ | |
"_id" : 0, | |
"name" : "CYLON-MACHINE:27666", | |
"health" : 1, | |
"state" : 1, | |
"stateStr" : "PRIMARY", | |
"uptime" : 358, | |
"optime" : Timestamp(1386797270, 1), | |
"optimeDate" : ISODate("2013-12-11T21:27:50Z"), | |
"self" : true | |
}, | |
{ | |
"_id" : 1, | |
"name" : "CYLON-MACHINE:27667", | |
"health" : 1, | |
"state" : 2, | |
"stateStr" : "SECONDARY", | |
"uptime" : 338, | |
"optime" : Timestamp(1386797270, 1), | |
"optimeDate" : ISODate("2013-12-11T21:27:50Z"), | |
"lastHeartbeat" : ISODate("2013-12-11T21:33:19Z"), | |
"lastHeartbeatRecv" : ISODate("2013-12-11T21:33:19Z"), | |
"pingMs" : 1, | |
"syncingTo" : "CYLON-MACHINE:27666" | |
}, | |
{ | |
"_id" : 2, | |
"name" : "CYLON-MACHINE:27668", | |
"health" : 1, | |
"state" : 2, | |
"stateStr" : "SECONDARY", | |
"uptime" : 329, | |
"optime" : Timestamp(1386797270, 1), | |
"optimeDate" : ISODate("2013-12-11T21:27:50Z"), | |
"lastHeartbeat" : ISODate("2013-12-11T21:33:18Z"), | |
"lastHeartbeatRecv" : ISODate("2013-12-11T21:33:18Z"), | |
"pingMs" : 0, | |
"syncingTo" : "CYLON-MACHINE:27666" | |
} | |
], | |
"ok" : 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.sequences.insert( | |
{ | |
_id: "posts", | |
seq: 0 | |
} | |
); |
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
function nextVal(name) { | |
var ret = db.sequences.findAndModify( | |
{ | |
query: { _id: name }, | |
update: { $inc: { seq: 1 } }, | |
new: true | |
} | |
); | |
return ret.seq; | |
} |
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.posts.insert( | |
{ | |
_id: nextVal("posts"), | |
title: "Tutorial de MongoDB. Operaciones de consulta" , | |
content: " En nuestra anterior entrada del tutorial de MongoDB ...", | |
status: "published" | |
} | |
); | |
db.posts.insert( | |
{ | |
_id: nextVal("posts"), | |
name: "Tutorial de MongoDB y C#. Conexión a la base de datos", | |
content: "Cuando queremos usar MongoDB desde C#, tenemos que crear una conexión ...", | |
status: "draft" | |
} | |
); |
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.people.find( | |
{ | |
age:{$gt:30} | |
}, | |
{ | |
name:1, | |
age: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.people.find( | |
{ | |
age:{$gte:30} | |
}, | |
{ | |
name:1, | |
age: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.people.find( | |
{ | |
age:{$lt:30} | |
}, | |
{ | |
name:1, | |
age: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.people.find( | |
{ | |
age:{$ne:30} | |
}, | |
{ | |
name:1, | |
age: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.people.find( | |
{ | |
age:{$in:[25,30,35]} | |
}, | |
{ | |
name:1, | |
age: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.people.find( | |
{ | |
company:{$exists:true} | |
}, | |
{ | |
name:1, | |
age:1, | |
company: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.people.find( | |
{ | |
company:{$type:2} | |
}, | |
{ | |
name:1, | |
age:1, | |
company: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.people.find( | |
{ $or: | |
[ | |
{gender:"female"}, | |
{age:{$gt:20}} | |
] | |
}, | |
{ | |
name:1, | |
gender:1, | |
age: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.people.find( | |
{ | |
gender:"female", | |
age:{$gt:20} | |
}, | |
{name:1,gender:1,age:1} | |
); | |
db.people.find( | |
{ | |
$and: | |
[ | |
{gender:"female"}, | |
{age:{$gt:20}} | |
] | |
}, | |
{name:1,gender:1,age: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.people.find( | |
{ | |
age:{$gt:30}, | |
age:{$lt:40} | |
}, | |
{name:1,gender:1,age:1} | |
); | |
db.people.find( | |
{ | |
age:{$lt:40}, | |
age:{$gt:30} | |
}, | |
{name:1,gender:1,age: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.people.find( | |
{ | |
$and: | |
[ | |
{age:{$gt:30}}, | |
{age:{$lt:40}} | |
] | |
}, | |
{name:1,gender:1,age: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.people.find( | |
{ | |
$or: | |
[ | |
{age:{$gt:30}}, | |
{ | |
$and:[ | |
{age:{$gt:50}}, | |
{gender:"female"} | |
] | |
} | |
] | |
} | |
); |
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.people.find( | |
{ | |
age:{$not:{$gt:30}} | |
} | |
); |
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.people.find( | |
{ | |
$nor: | |
[ | |
{age:{$gt:30}}, | |
{isActive:true} | |
] | |
}, | |
{age:1,isActive: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.people.find( | |
{ | |
$nor: | |
[ | |
{age:{$gt:30}}, | |
{age:{$exists:false}}, | |
{isActive:true}, | |
{isActive:{$exists:false}} | |
] | |
} | |
); |
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:1, | |
name:"Pedro", | |
age:23, | |
savedPoints:[200,10,30] | |
}, | |
{ | |
_id:2, | |
name:"Mariano", | |
age:48, | |
savedPoints:[50,85] | |
} |
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:1,savedPoints:[200,10,30] }, | |
{_id:2,savedPoints:[50,85] } |
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:1,totalPoints:240}, | |
{_id:2,totalPoints:135 } |
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.people.aggregate( | |
{ | |
$group: | |
{ | |
_id:"$gender", | |
totalAge:{$sum:"$age"}, | |
totalPeople:{$sum: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
var map = function() | |
{ | |
var key=this.gender; | |
var value = { "totalPeople":1, "totalAge":this.age}; | |
emit(key,value); | |
}; |
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
var reduce = function(keys,values) | |
{ | |
var reduced = | |
{ | |
totalPeople:0, | |
totalAge:0 | |
}; | |
for (var i=0; i < values.length;i++) | |
{ | |
reduced.totalPeople+=values[i].totalPeople; | |
reduced.totalAge+=values[i].totalAge; | |
} | |
return reduced; | |
}; |
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.map_reduce_result.find(); | |
/* 0 */ | |
{ | |
"_id" : "female", | |
"value" : { | |
"totalPeople" : 288, | |
"totalAge" : 8545 | |
} | |
} | |
/* 1 */ | |
{ | |
"_id" : "male", | |
"value" : { | |
"totalPeople" : 271, | |
"totalAge" : 8241 | |
} | |
} |
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.people.aggregate( | |
{ | |
$match:{ | |
$and:[ | |
{isActive:true}, | |
{age:{$gte:25}} | |
] | |
} | |
}); |
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.people.aggregate( | |
{ | |
$match: { | |
isActive:true, | |
age:{$gte:25} | |
} | |
}); |
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.people.aggregate( | |
{ | |
$match:{ | |
$and: | |
[ | |
{ | |
$or:[ | |
{age:{$gte:40}}, | |
{age:{$lte:30}} | |
] | |
}, | |
{isActive: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
db.people.aggregate( | |
{ | |
$match:{ | |
$or: | |
[ | |
{age:{$gte:40}}, | |
{age:{$lte:30}}, | |
{isActive: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
db.people.aggregate( | |
{ | |
$match:{ | |
age:{$not:{$gte:40}} | |
} | |
}); |
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.people.aggregate( | |
{ | |
$project: | |
{ | |
_id:-1, | |
name:1, | |
tipo:{ | |
$cond:[{$gte:["$age",65]},"Pensionista","Normal"] | |
} | |
} | |
}); |
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.people.aggregate( | |
{ | |
$project: | |
{ | |
_id:-1, | |
name:1, | |
location:{ | |
$ifNull:["$latitude","Sin datos"] | |
} | |
} | |
}); |
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.people.find({tags:"laborum"},{name:1,tags: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.people.find( | |
{ | |
tags: | |
{ | |
$all:["laborum","sunt"] | |
} | |
}, | |
{name:1,tags: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.people.find( | |
{ | |
tags: | |
{ | |
$in:["laborum","sunt","nisi"] | |
} | |
}, | |
{name:1,tags: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.people.find( | |
{ | |
tags: | |
{ | |
$nin:["laborum","sunt","nisi"] | |
} | |
}, | |
{name:1,tags: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.people.find({tags:{$size:3}}) |
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.people.find( | |
{ | |
tags: | |
{ | |
$in:["laborum","sunt","nisi"] | |
} | |
}, | |
{"tags.$":1,name: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.people.find( | |
{ | |
tags: | |
{ | |
$in:["laborum","sunt","nisi"] | |
} | |
}, | |
{tags:{$slice:3},name: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.people.find( | |
{ | |
tags: | |
{ | |
$in:["laborum","sunt","nisi"] | |
} | |
}, | |
{tags:{$slice:-3},name: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.people.find( | |
{ | |
tags: | |
{ | |
$in:["laborum","sunt","nisi"] | |
} | |
}, | |
{tags:{$slice:[2,3]},name: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.people.find( | |
{ | |
tags: | |
{ | |
$in:["laborum","sunt","nisi"] | |
} | |
}, | |
{tags:{$slice:[-2,3]},name: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.people.find({"tags.1":"enim"}); |
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.people.find( | |
{ | |
friends: | |
{ | |
id:1, | |
name:"Trinity Ford" | |
} | |
}); |
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.people.find({"friends.name":"Trinity Ford"}); |
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.people.find( | |
{ | |
"friends.2.name":{$gte:"T"} | |
}, | |
{friends:{$slice:-1},name: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.people.find( | |
{ | |
"name": {$regex:".*r$"} | |
}, | |
{name: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.people.find( | |
{ | |
"name": {$regex:".*fis"} | |
}, | |
{name:1}); | |
db.people.find( | |
{ | |
"name": {$regex:".*Fis"} | |
}, | |
{name: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.people.find( | |
{ | |
"name": {$regex:".*fis", $options:"i"} | |
}, | |
{name: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.people.find( | |
{"friends.2.name":{$gte:"T"} | |
}).count(); |
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.people.find( | |
{ | |
"friends.2.name":{$gte:"T"} | |
}, | |
{_id:0,name:1}).sort({name: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.people.find( | |
{ | |
"friends.2.name":{$gte:"T"} | |
}, | |
{_id:0,name:1}).sort({name: -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.people.find( | |
{ | |
"friends.2.name":{$gte:"T"} | |
}, | |
{_id:0,name:1,email:1}).sort({name:1,email: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.people.find( | |
{ | |
"friends.2.name":{$gte:"T"} | |
}, | |
{name:1}).limit(5) |
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.people.find( | |
{ | |
"friends.2.name":{$gte:"T"} | |
}, | |
{name:1}).skip(5) |
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
var myArray = | |
db.people.find( | |
{ | |
"friends.2.name":{$gte:"T"} | |
}, | |
{name:1}).toArray() |
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.people.find( | |
{ | |
"friends.2.name":{$gte:"T"} | |
}, | |
{name:1}).skip(10).limit(5) |
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.people.find( | |
{ | |
"friends.2.name":{$gte:"T"}}, | |
{name:1}).sort({name:1}).limit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment