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.collection.aggregate([ | |
{ | |
"$group": { | |
"_id": { | |
"date": { | |
$dateToString: { | |
format: "%Y-%m-%d", | |
date: "$time" | |
} | |
}, |
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.collection.aggregate([ | |
{ | |
"$group": { | |
"_id": { | |
"$dateToString": { | |
"format": "%Y-%m-%d", | |
"date": "$time" | |
} | |
}, | |
"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.collection.aggregate([ | |
{ | |
"$project": { | |
"_id": 1, | |
"product": 1, | |
"time": { | |
"$dateToString": { | |
"format": "%Y-%m-%d", | |
"date": "$time" | |
} |
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.collection.aggregate([ | |
{ | |
"$project": { | |
"_id": 1, | |
"product": 1, | |
"day": { | |
"$dayOfMonth": "$time" | |
}, | |
"month": { | |
"$month": "$time" |
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
[ | |
{ | |
"time": ISODate("2019-01-28T15:57:41.269Z"), | |
"product": "MacBook Pro" | |
}, | |
{ | |
"time": ISODate("2019-01-28T15:57:41.269Z"), | |
"product": "iPhone 7" | |
}, | |
{ |
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": "2019-1-28", | |
"count": 2 | |
}, | |
{ | |
"_id": "2019-1-27", | |
"count": 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
app.inputs.search({ input: { url: 'http://healthypets.royalcanin.com.au/assets/Uploads/_resampled/ScaleWidthWyI2MDAiXQ/golden-retriever-getting-to-know.jpg' } }).then( | |
function (response) { | |
response.hits.forEach(hit => { | |
console.log(hit.score); | |
console.log(hit.input.data.image); | |
}); | |
}, | |
function (err) { | |
console.log(err); | |
} |
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
app.inputs.create([ | |
{ | |
url: "https://s3.amazonaws.com/cdn-origin-etr.akc.org/wp-content/uploads/2017/11/12225358/Pug-On-White-01.jpg" | |
}, | |
{ | |
url: "https://s3.amazonaws.com/cdn-origin-etr.akc.org/wp-content/uploads/2017/11/12121353/GoldenRetriever1_stacked.jpg" | |
}, | |
{ | |
url: "https://s3.amazonaws.com/cdn-origin-etr.akc.org/wp-content/uploads/2017/11/12130118/Golden-Retriever-Standing1.jpg" | |
}, |
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
// Require the client | |
const Clarifai = require('clarifai'); | |
// initialize with your api key. This will also work in your browser via http://browserify.org/ | |
const app = new Clarifai.App({ | |
apiKey: 'YOUR_API_KEY' | |
}); |
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
app.inputs.search({ concept: { name: 'golden retriever' } }).then( | |
function (response) { | |
response.hits.forEach(hit => { | |
console.log(hit.score); | |
console.log(hit.input.data.image); | |
}); | |
}, | |
function (err) { | |
console.log(err); | |
} |
NewerOlder