Created
January 18, 2020 02:39
-
-
Save peytonmcnully/1474e45223c2067bc6d3c9968ac0ebfe to your computer and use it in GitHub Desktop.
download both files
This file contains hidden or 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 couchbase = require('couchbase') | |
| var cluster = new couchbase.Cluster('couchbase://167.172.139.14/'); | |
| cluster.authenticate('Administrator', 'andystrator'); | |
| var bucket = cluster.openBucket('bucketohshiii'); | |
| var N1qlQuery = couchbase.N1qlQuery; | |
| bucket.manager().createPrimaryIndex(function() { | |
| bucket.upsert('user:king_arthur', { | |
| 'email': '[email protected]', 'interests': ['Holy Grail', 'African Swallows'] | |
| }, | |
| function (err, result) { | |
| bucket.get('user:king_arthur', function (err, result) { | |
| console.log('Got result: %j', result.value); | |
| bucket.query( | |
| N1qlQuery.fromString('SELECT * FROM bucketname WHERE $1 in interests LIMIT 1'), | |
| ['African Swallows'], | |
| function (err, rows) { | |
| console.log("Got rows: %j", rows); | |
| }); | |
| }); | |
| }); | |
| }); |
This file contains hidden or 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
| { | |
| "name": "gator", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1" | |
| }, | |
| "author": "", | |
| "license": "ISC", | |
| "dependencies": { | |
| "couchbase": "^2.6.10" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment