Skip to content

Instantly share code, notes, and snippets.

<?php
$c = (new MongoClient())->demo->points;
$c->find( [
'loc' => [
'$geoWithin' => [
'type' => 'Polygon',
'coordinates' => [ [
[ -0.91, 51.74 ],
[ -0.91, 51.27 ],
<?php
$c = (new MongoClient())->demo->points;
$c->find( [
'loc' => [
'$geoWithin' => [
'type' => 'Polygon',
'coordinates' => [ [
[ -0.91, 51.74 ],
[ -0.91, 51.27 ],
mongocxx::driver::client c{“mongo://example.com:27017”};
auto col = c[“testdb”][“testcol”];
for (auto doc : col.find({}) {
std::cout << bsoncxx::to_json(doc) << std::endl;
}
bsoncxx::builder::stream::document doc;
doc << “mykey” << “myvalue”
<< “mynum” << 1;
optional<result::insert_one> res = col.insert_one(doc);