Documentation |
---|
blog-comments-simple |
ToDo (Web) |
ToDo (Android) |
ToDo (iOS) |
Dashboard |
IoT Temperature Tracker |
mongodb / stitch-examples Goto Github PK
View Code? Open in Web Editor NEWMongoDB Stitch Examples
License: Apache License 2.0
MongoDB Stitch Examples
License: Apache License 2.0
Following code runs fine with nodejs and aggregated results will be inserted into zz
collection, but the same code running via trigger
(atlas + stitch) always failed to insert results into zz
, wondering is this expected or a bug?
db.getCollection('bakesales')
.aggregate( [
{ $match: { date: { $gte: new Date('1970-01-01') } } },
{ $group: { _id: { $dateToString: { format: "%Y-%m", date: "$date" } }, sales_quantity: { $sum: "$quantity"}, sales_amount: { $sum: "$amount" } } },
{ $merge: { into: {db: 'test', coll:"zz"}, whenMatched: "replace" } }
] )
Got below error when I try to run todo example. Pls help.
c:\Users\test\Documents\Tutorials\todo> npm start
....
....
41% building modules 265/266 modules 1 active ...\todo\node_modules\fbjs\lib\is
Version: webpack 3.12.0
Time: 11452ms
Asset Size Chunks Chunk Names
bundle.js 1.33 MB 0 [emitted] [big] main
[7] ./node_modules/react/react.js 55 bytes {0} [built]
[29] (webpack)/hot/log.js 1.01 kB {0} [built]
[42] (webpack)/hot/emitter.js 89 bytes {0} [built]
[67] (webpack)-dev-server/client?http://0.0.0.0:8001 7.93 kB {0} [built]
[71] (webpack)/hot/log-apply-result.js 1.3 kB {0} [built]
[116] multi (webpack)-dev-server/client?http://0.0.0.0:8001 webpack/hot/dev-ser
ver webpack-dev-server/client?http://0.0.0.0:8001 webpack/hot/only-dev-server ./
src/index.js 76 bytes {0} [built]
[129] (webpack)-dev-server/client/overlay.js 3.67 kB {0} [built]
[136] (webpack)/hot/dev-server.js 1.59 kB {0} [built]
[137] (webpack)/hot/only-dev-server.js 2.36 kB {0} [built]
[138] ./src/index.js 21.2 kB {0} [built]
[153] ./node_modules/react-dom/index.js 58 bytes {0} [built]
[239] ./node_modules/mongodb-stitch/dist/node/index.js 1.71 kB {0} [built] [fai
led] [1 error]
[240] ./node_modules/react-router/es/index.js 1.58 kB {0} [built]
[250] ./node_modules/react-router-dom/es/index.js 2.21 kB {0} [built]
[263] ./static/todo.scss 1.19 kB {0} [built]
+ 251 hidden modules
ERROR in ./node_modules/mongodb-stitch/dist/node/index.js
Module build failed: ReferenceError: Unknown plugin "babel-plugin-add-module-exp
orts" specified in "c:\\Users\\test\\Documents\\Tutorials\\todo\\node_modules
\\mongodb-stitch\\.babelrc" at 2, attempted to resolve relative to "c:\\Users\\s
hameer\\Documents\\Tutorials\\todo\\node_modules\\mongodb-stitch"
at c:\Users\test\Documents\Tutorials\todo\node_modules\babel-core\lib\tra
nsformation\file\options\option-manager.js:180:17
at Array.map (<anonymous>)
at Function.normalisePlugins (c:\Users\test\Documents\Tutorials\todo\node
_modules\babel-core\lib\transformation\file\options\option-manager.js:158:20)
at OptionManager.mergeOptions (c:\Users\test\Documents\Tutorials\todo\nod
e_modules\babel-core\lib\transformation\file\options\option-manager.js:234:36)
at OptionManager.init (c:\Users\test\Documents\Tutorials\todo\node_module
s\babel-core\lib\transformation\file\options\option-manager.js:368:12)
at File.initOptions (c:\Users\test\Documents\Tutorials\todo\node_modules\
babel-core\lib\transformation\file\index.js:212:65)
at new File (c:\Users\test\Documents\Tutorials\todo\node_modules\babel-co
re\lib\transformation\file\index.js:135:24)
at Pipeline.transform (c:\Users\test\Documents\Tutorials\todo\node_module
s\babel-core\lib\transformation\pipeline.js:46:16)
at transpile (c:\Users\test\Documents\Tutorials\todo\node_modules\babel-l
oader\lib\index.js:50:20)
at Object.module.exports (c:\Users\test\Documents\Tutorials\todo\node_mod
ules\babel-loader\lib\index.js:175:20)
@ ./src/index.js 13:21-46
@ multi (webpack)-dev-server/client?http://0.0.0.0:8001 webpack/hot/dev-server
webpack-dev-server/client?http://0.0.0.0:8001 webpack/hot/only-dev-server ./src/
index.js
webpack: Failed to compile.
For the android-mobile todo example, I am experiencing the following exception upon build (without changing anything):
2018-12-20 10:35:01.605 5705-5705/com.mongodb.stitch.sdk.examples.todo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mongodb.stitch.sdk.examples.todo, PID: 5705
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mongodb.stitch.sdk.examples.todo/com.mongodb.stitch.sdk.examples.todo.MainActivity}: com.mongodb.embedded.client.MongoClientEmbeddedException: The mongo embedded library could not be initialized
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: com.mongodb.embedded.client.MongoClientEmbeddedException: The mongo embedded library could not be initialized
at com.mongodb.embedded.client.MongoClients.init(MongoClients.java:49)
at com.mongodb.stitch.android.services.mongodb.local.internal.AndroidEmbeddedMongoClientFactory.<init>(AndroidEmbeddedMongoClientFactory.java:33)
at com.mongodb.stitch.android.services.mongodb.local.internal.AndroidEmbeddedMongoClientFactory.getInstance(AndroidEmbeddedMongoClientFactory.java:41)
at com.mongodb.stitch.android.services.mongodb.local.LocalMongoDbService$1.getClient(LocalMongoDbService.java:53)
at com.mongodb.stitch.android.services.mongodb.local.LocalMongoDbService$1.getClient(LocalMongoDbService.java:44)
at com.mongodb.stitch.android.core.internal.StitchAppClientImpl.getServiceClient(StitchAppClientImpl.java:110)
at com.mongodb.stitch.sdk.examples.todo.MainActivity.onCreate(MainActivity.java:87)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: com.mongodb.embedded.capi.MongoEmbeddedCAPIException: Unable to load the Mongo Embedded Library.
Please either: Set the libraryPath when calling MongoEmbeddedCAPI.create or
Ensure the library is set on the jna.library.path or the java.library.path system property.
at com.mongodb.embedded.capi.MongoEmbeddedCAPI.create(MongoEmbeddedCAPI.java:87)
at com.mongodb.embedded.client.MongoClients.init(MongoClients.java:46)
... 21 more
Caused by: java.lang.UnsatisfiedLinkError: Unable to load library 'mongo_embedded': Native library (android-x86/libmongo_embedded.so) not found in resource path (.)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:303)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:427)
at com.sun.jna.Native.register(Native.java:1647)
at com.mongodb.embedded.capi.internal.CAPI.<clinit>(CAPI.java:164)
at com.mongodb.embedded.capi.MongoEmbeddedCAPI.create(MongoEmbeddedCAPI.java:84)
... 22 more
It seems there have been some changes to Atlas since this tutorial was made, especially with Rules. I'm having trouble bridging the gap for permissions. Now instead of read and right rules there are now roles? I've read the documentation but I'm still getting errors on npm start
. I'm sure I'm missing something, I've tried importing the stitch app provided but it won't import, might be out of date as previously stated.
The todo webapp tutorial does not specify that you need to create a mongdb-atlas cluster when you import the application in the documentation and also makes the assumption that the user has named the cluster StitchDemoCluster
as shown here.
I would suggest adding some information in the tutorial stating that the user should set up a cluster similar to what was done with the dashboard tutorial. I would also suggest changing the default clusterName
in config.json
to Cluster0
as this is the default name that M0
clusters are created with if the name is not changed.
Extra "s" on line 9.
After integrating google plus sign in.
this.googlePlus.login({ 'webClientId': '', 'offline': true }).then(res => { console.log('googlePlus', res); }).catch(err => console.error('googlePlus', err));
we will get the user details and how we can send details of the user to the server via stitch api to create a new user record
Hi I am getting an error at Realm functions,
Calling from iOS app.
app.functions.token([]) { result, error in print(error) print(result) }
Error Domain=realm::app::ServiceError Code=14 "TypeError: Cannot access member 'post' of undefined"
`exports = function() {
return context.https.post({
url: "https://apiuat.test.blabla-payments.com/token",
headers: {
"Content-Type":"application/x-www-form-urlencoded"
//"Cookie":"d944fa525886d228904d507202154efa=d9e464068b828f7908d934beed4bd7c9; TS012f2652=01ad890da991078df75e3f20a99b772ed008d580c232a9fb392522a704402c550596b532540c8c3526a8f1f4f997e111e01468c4800e7ae828508cac14bf16a90782d05878"
},
body: { merchantId:906933
,password:"u16q9rZ02bW0jqTjxH8t"
,allowOriginUrl:null
,timestamp:Date.now()
,action:"PURCHASE"
,customerId:"sample-0002"
,amount:25.00
,currency:"EUR"
,country:"IE"
,language:"en"
,customerFirstName:"selcuk"
,customerLastName:"yucel"
,merchantNotificationUrl:"https://ptsv2.com/t/post" },
encodeBodyAsJSON: true
})
.then(response => {
// The response body is encoded as raw BSON.Binary. Parse it to JSON.
const ejson_body = EJSON.parse(response.body.text());
console.log("Result: ",ejson_body)
return ejson_body;
})
};`
ERROR
TypeError: Cannot access member 'post' of undefined
trace:
TypeError: Cannot access member 'post' of undefined
at exports (token.js:4:12)
at apply ()
at token_wrapper.js:2:5
at execute ()
at apply ()
at :16:10
at :12:1
Chrome console shows error:
Uncaught TypeError: Cannot read property 'timestamp' of undefined
at refreshGraph ((index):104)
at (index):97
Showing Recent Messages
👎 /Users/alexandregiguere/Documents/Development/Stitch/stitch-examples/todo/ios/Pods/Target Support Files/Pods-MongoDBSample/Pods-MongoDBSample.debug.xcconfig: unable to open file (in target "MongoDBSample" in project "MongoDBSample") (in target 'MongoDBSample')
I just clone your project and I got this error when I build the iOS project in Xcode.
Also, looks like your framework are not updated to Swift 4.2, I got a compile errors about that,
If I do a pod update, it's even worst, I got others errors.
thanks
I looks like the MongoDB libraries have been updated and these libraries no longer work. The PlateSpace code refers to: compile 'org.mongodb:stitch:0.1.0-SNAPSHOT'
while the Stitch online pages point to compile 'org.mongodb:stitch:1.0.0-SNAPSHOT'
Now my app has stopped work and gives me an error $geoNear pipeline is not supported.
I'm linking here to the post I made on the stitch-cli
repo Issues forum about the problems I'm having trying to import the Todo example to my MongoDB Atlas account:
https://github.com/10gen/stitch-cli/issues/63
Any help would be appreciated.
node data_generator.js
{ error: 'TypeError: Cannot access member \'db\' of undefined',
error_code: 'FunctionExecutionError',
link: 'xxx' }
The hyperlink to the blog example application in readme.md
file is no longer working, the rest are fine but it seems this one wasn't mapped after path changes.
I am following along with the Web Todo app tutorial here:
https://docs.mongodb.com/stitch/tutorials/todo-twilio-web/
The tutorial appears to be out of sync with the MongoDB/Stitch content you see in the Atlas dashboard. When you reach the section defined as:
Integrate the ToDo App with Twilio
Section: B. Configure the Stitch MongoDB Service for Twilio Integration.
The tutorial tells you to create a database (todo) and two collections (items/users). Those elements were already present in my dashboard for the imported app.
On the same page in this section:
Configure the function for the twilioWebhook webhook
The twilioWebhook also appears to have been created for you, making that section unnecessary too.
The same applies to this section:
Configure the function to send verification codes.
I'm going to forge ahead anyways and ignore the parts of the tutorial that at least seem to be superfluous now. But I wanted to bring this to your attention.
This is an issue with the write up.
In the Basic Blog write up, the code uses toArray() in the displayComments() function. It should use asArray() (which is correct in the code posted here).
Also, #82 identified by @JoeKarlsson is still not corrected in the main code.
DataSynchronizer console log is so frequency,can I turn off console log?
2019-02-19 10:39:58.946140+0800 FoundationDemo[62736:20983574] [sync] (
"dataSynchronizer-m-mongodb-atlas",
"t='20': syncRemoteToLocal START"
)
2019-02-19 10:39:58.947019+0800 FoundationDemo[62736:20983574] [sync] (
"dataSynchronizer-m-mongodb-atlas",
"t='20': syncRemoteToLocal END"
)
hi, nice work with Stitch and Stitch sync beta.
when running the Todo sync sample app for Android, i noticed that if i made a change ON THE SERVER via the Stitch web UI, to a document in the collection (ie todo.items) --> that change would NOT sync back to the running Android app.
looking in the logs I saw this:
2019-01-11 11:13:51.022 15480-16912/com.mongodb.stitch.sdk.examples.todo E/items: NamespaceChangeStreamListener::stream ns=todo.items exception on fetching next event: java.lang.IllegalStateException: expected updatedFields to be present
java.lang.IllegalStateException: expected updatedFields to be present
Is this a bug with the Stitch sync API ?
Also, this error listener/handler in the sample Android app did not trigger. I would have thought that it should have ?
private class MyErrorListener implements ErrorListener {
@Override
public void onError(BsonValue documentId, Exception error) {
Log.e("Stitch", error.getLocalizedMessage());
Set<BsonValue> docsThatNeedToBeFixed = _remoteCollection.sync().getPausedDocumentIds();
for (BsonValue doc_id : docsThatNeedToBeFixed) {
// Add your logic to inform the user.
// When errors have been resolved, call
_remoteCollection.sync().resumeSyncForDocument(doc_id);
}
}
}
I'm having a problem with the Stitch server generating a URL for the Facebook login process that appears to be double-encoded with the encodeUri() method, breaking the login process. Please see this Stack Overlow post:
This is occurring in my fork of the Web Todo app Stitch example.
I can't get any items that are added on the backend to show up in the stitch example todo app.
Is this a limitation of stitch?
I think somewhere the documentation suggests you can integrate existing atlas data into the stitch app but even if I just duplicate the todo item in Compass and change the title, it doesn't appear.
Boy oh boy. Couldn't even get the project running after trying to fix the myriad build exceptions in Xcode. Please try to keep these examples up to date with the API's and actually building/working so people that are interested in using Stitch / Mongo Atlas have a decent place to start.
provisioning profile build error: seems like someone left a hardcoded prov. profile var in Build Settings. I had to delete that, set to "automatic" etc etc
import MongoSwiftMobile
- doesn't exist
remoteMongoDBServiceClientFactory
- use of unresolved identifier. So what exactly should be used here instead ?Using Xcode 10.0 and following all the steps in the ToDo tutorial (https://docs.mongodb.com/stitch/tutorials/todo-ios/), I get this build error that I can't get past.
No such module 'FacebookLogin'
At the top of TodoListViewController.swift are the lines:
...
import UIKit
import FacebookLogin
import FacebookCore
import StitchCore
...
If I switch the order of the imports, the first under UIKit is the one reported as not found.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.